# basicPower

basicPower computes the basic power transformation

## Syntax

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

## Description

 Ytra =basicPower(Y, ColtoTra, la) Example of transformation.

 Ytra =basicPower(Y, ColtoTra, la, Name, Value) Simulated data check inverse transformation.

## Examples

expand all

### Example of transformation.

Mussels data.

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 using
% basic power transformation
Y1=basicPower(Y,[],la);

### Simulated data check inverse transformation.

n=100;p=5;
Y=abs(randn(n,p));
la=[0.5 0 -0.5 2 0];
% Transform all columns of matrix Y according to the values of la
Ytra=basicPower(Y,[],la);
Ychk=basicPower(Ytra,[],la,'inverse',true);
disp(max(max(abs(Y-Ychk))))

## Input Arguments

### 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. Vector.

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.

Example:  'inverse',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

## Output Arguments

### Ytra —transformed data matrix.  Matrix

n x v data matrix containing transformed observations When $\lambda \ne 0$ $ytra = y^\lambda$ else $ytra = log(y)$

## 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.