1

Has anyone implemented a Box Cox approach in MATLAB to transform multivariate data? I've found an R package that does it, but nothing for MATLAB. Thanks.

2 Answers 2

1

MATLAB do not have built in function to implement multivariate box-cox transformaion.

I have written one myself and it works.

Here is the code.

The input x is the obervation matix, where the rows denote the obervations and the columns denote the variables.

Reference: Applied Multivariate Statistical Analysis 6th- Johnson R. & Wichern D. Chapter 4.8 Transformations to Near Normality

function lambda=boxcoxn(x)
[m,n]=size(x);
lambda_ini=zeros(n,1);
for ii=1:n
    [temp,lambda_ini(ii,1)]=boxcox(x(:,ii));
end
fun=@(lambda)(log(det((cov(((x.^repmat(lambda',m,1)-1)./repmat(lambda',m,1))))))*m/2-(lambda-1)'*(sum(log(x)))');
lambda=fminsearch(fun,lambda_ini);
end

Just feel free to use it.

0

Googling "MATLAB Box Cox" tells me that:

  1. Box-Cox transformations are available in Financial Toolbox
  2. There is a freely available implementation on MATLAB Central File Exchange.
1
  • Thanks so much dude but maybe you should read entirely the answer. I'm looking for a multivariate power transformation, not an univariate one, that is the one you linked. Mar 26, 2013 at 14:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.