normYJpn

normYJpn computes (normalized) extended Yeo-Johnson transformation

Syntax

  • Ytra=normYJpn(Y,ColtoTra,la)example
  • Ytra=normYJpn(Y,ColtoTra,la,Name,Value)example

Description

The transformations for negative and positive responses were determined by Yeo and Johnson (2000) by imposing the smoothness condition that the second derivative of zYJ(λ) with respect to y be smooth at y = 0. However some authors, for example Weisberg (2005), query the physical interpretability of this constraint which is oftern violated in data analysis. Accordingly, Atkinson et al (2019) and (2020) extend the Yeo-Johnson transformation to allow two values of the transformations parameter: λN for negative observations and λP for non-negative ones.

example

Ytra =normYJpn(Y, ColtoTra, la) Example of use of normYJext with all default options.

example

Ytra =normYJpn(Y, ColtoTra, la, Name, Value) Compare Yeo & Johnson with extended Yeo and Yohnson.

Examples

expand all

  • Example of use of normYJext with all default options.
  • Transform value -3, -2, ..., 3

    y=(-3:3)';
    lambda=[-0.5 0.5]
    y1=normYJpn(y,1,lambda)
    plot(y,y1)
    xlabel('Original values')
    ylabel('Transformed values')

  • Compare Yeo & Johnson with extended Yeo and Yohnson.
  • Transform value -3, -2, ..., 3

    k=3;
    y=(-k:0.01:k)'; 
    % Two values of lambda for extended Yeo and Johnson
    lambda=[0 0.5];
    Jacobian=false;
    % Just one value of lambda for traditional Yao and Johnson
    y1=normYJ(y,1,lambda(1),'Jacobian',Jacobian);
    ypn=normYJpn(y,1,lambda,'Jacobian',Jacobian);
    plot(y,[y1 ypn])
    xlabel('Original values')
    ylabel('Transformed values')
    legend({['YJ with $\lambda$=' num2str(lambda(1))],...
    ['$YJ_{ext}$ with $\lambda_P$=' num2str(lambda(1)) ' and  $\lambda_N$=' num2str(lambda(2))]},...
    'Interpreter','latex')

    Related Examples

    expand all

  • Simulated data check inverse transformation.
  • n=100;p=5;
    Y=randn(n,p);
    Y(3,1:3)=0;
    % Different values of transformation parameters for positive and
    % negative observations
    la=[[0.5; 0; -0.5; 2; 0] , [0.5; 0; -0.5; 2; 0]+0.8];
    % Transform all columns of matrix Y according to the values of la
    Ytra=normYJpn(Y,[],la,'Jacobian',false);
    Ychk=normYJpn(Ytra,[],la,'Jacobian',false,'inverse',true);
    disp(max(max(abs(Y-Ychk))))

    Input Arguments

    expand all

    Y — Input data. Matrix.

    n x v data matrix; n observations and v variables. Rows of Y represent observations, and columns represent variables.

    Missing values (NaN's) and infinite values (Inf's) are allowed, since observations (rows) with missing or infinite values will automatically be excluded from the computations.

    Data Types: single|double

    ColtoTra — Variable to transform. Vector.

    k x 1 integer vector specifying the variables which must be transformed. If it is missing and length(la)=v all variables are transformed

    Data Types: single|double

    la — transformation parameters. Matrix.

    k x 2 vector containing set of transformation parameters for the k ColtoTra. The first column contains the transformation parameter for positive observations and the second column the transformation parameter for negative observations.

    Data Types: single|double

    Name-Value Pair Arguments

    Specify optional comma-separated pairs of Name,Value arguments. Name is the argument name and Value is the corresponding value. Name must appear inside single quotes (' '). You can specify several name and value pair arguments in any order as Name1,Value1,...,NameN,ValueN.

    Example: 'inverse',true , 'Jacobian',true

    inverse —Inverse transformation.logical.

    If inverse is true, the inverse transformation is returned. The default value of inverse is false.

    Example: 'inverse',true

    Data Types: Logical

    Jacobian —Requested Jacobian of transformed values.true (default) | false.

    If true (default) the transformation is normalized to have Jacobian equal to 1

    Example: 'Jacobian',true

    Data Types: Logical

    Output Arguments

    expand all

    Ytra —transformed data matrix. Matrix

    n x v data matrix containing transformed observations The Yeo-Johnson transformation is the Box-Cox transformation of y+1 for nonnegative values, and of |y|+1 with parameter 2-lambda for y negative.

    References

    Atkinson, A.C. Riani, M., Corbellini A. (2019), The analysis of transformations for profit-and-loss data, Journal of the Royal Statistical Society, Series C, "Applied Statistics", https://doi.org/10.1111/rssc.12389

    Atkinson, A.C. Riani, M. and Corbellini A. (2021), The Box–Cox Transformation: Review and Extensions, "Statistical Science", Vol. 36, pp. 239-255, https://doi.org/10.1214/20-STS778

    Yeo, I.K and Johnson, R. (2000), A new family of power transformations to improve normality or symmetry, "Biometrika", Vol. 87, pp. 954-959.

    See Also

    |

    This page has been automatically generated by our routine publishFS