MATLAB Answers

Box-cox transformation isn't working!?

5 views (last 30 days)
Sophie Chumas
Sophie Chumas on 14 Jan 2020
Commented: Sophie Chumas on 15 Jan 2020
Hi, it's me (AGAIN), another time another problem...
I've written the following code - where strength is a matrix of data [128 x 1] that has a non-normal distribution. Below I have tried to apply the box-cox transformation but it still returns the kstest as 1...what am I doing wrong!?
Thanks! :)
%%Box-cox transformation
%applying box-cox
[box_cox_strengths, lambda] = boxcox(strength);
box_cox_data = [box_cox_strengths pure_time];
[h, p] = kstest(box_cox_strengths);


Sign in to comment.

Answers (1)

David Hill
David Hill on 14 Jan 2020
My understanding is that the boxcox() transformation changes the data into an approximately normal distribution. And the kstest() tests if the data is from a normal distribution and returns 1 if it is. Therefore, it seems that everything is working fine.

  1 Comment

Sophie Chumas
Sophie Chumas on 15 Jan 2020
Ah, might've gotten confused with interpreting the results of the kstest then! Thanks.
Although when I apply the kstest to the original non-normally distributed data, it comes out with the same answer...other people have been getting '0' returned when their distribution has been transformed by box-cox, and '1' for their initial distribution thus suggesting if it's normal, the kstest outcome is '0'??
Thanks! :)

Sign in to comment.

Sign in to answer this question.

Translated by