load('mussels.mat');
Y=mussels{:,:};
la=[0.5 0 0.5 0 0];
% Transform all columns of matrix Y according to the values of la
Ytra=normBoxCox(Y,[],la,'Jacobian',false);
Ychk=normBoxCox(Ytra,[],la,'inverse',true);
disp(max(max(abs(Y-Ychk))))
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.
k x 1 vector containing set of transformation
parameters for the k ColtoTra.
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.
The default value of bsb is 1:n, that is all units are
used to compute the Jacobian. Note that this option takes
effect just if option Jacobian is true.
If true (default) the transformation is normalized
to have Jacobian equal to 1. Note that this optional
argument is ignored if previous optional argument inverse
is true
n x v data matrix containing
transformed observations
When $\lambda \ne 0$
if jacobian=true:
$ytra = (y^\lambda-1)/ (G^{(\lambda-1)} \lambda)$;
else if jacobian=false:
$ytra = (y^\lambda-1)/ \lambda$;
where $G$ is the geometric mean of the observations.
When $\lambda = 0$
if jacobian=true:
$ytra = G log(y)$;
else if jacobian=false:
$ytra = log(y)$;
where $G$ is the geometric mean of the observations.
References
Box, G.E.P. and Cox, D.R. (1964), An analysis of transformations (with
Discussion), "Journal of the Royal Statistical Society Series B",
Vol. 26, pp. 211-252.