Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

anova2 is not working properly

Asked by Mark on 27 Apr 2013

Hello,

I have recently taken introductory statistics and used a variety of software aids to get through the course. Primarily I used MS excel because our textbook referenced it heavily. I am now learning how to use Matlab to answer and analyze some of the datasets from my homework sets. In particular, we just covered two-way ANOVA, which is the function anova2 in matlab. To my dismay I have learned that the anova2 function is not working properly on my installed matlab. I used the popcorn example from the matlab documentation for anova2 exactly as prompted in the text and compared the results to the same dataset analyzed in excel. The excel two-way anova worked flawlessly and exactly reproduced the matlab example's output, whereas the matlab anova2 output was completely different and mathematically wrong. What might be wrong with my installed version of matlab?

Thank you,

Mark Lies

0 Comments

Mark

Tags

Products

No products are associated with this question.

1 Answer

Answer by Wayne King on 27 Apr 2013
Accepted answer

Can you please provide your MATLAB version number? I am able to produce exactly the Anova table shown in the MATLAB documentation for anova2. Are you saying that you get something in MATLAB different from what is shown in the documentation?

If so, the next important question to ask is whether you are sure you are using the MathWorks' anova2 function from the Statistics Toolbox. Often people download some other .m file or have another .m file on their path ahead of a MathWorks' function with the same name. If you enter

>>which anova2

do you get something back like:

matlab\toolbox\stats\stats\anova2.m

1 Comment

Mark on 2 May 2013

Dear Mr. or Dr. King,

Thank you for taking time to respond to my question. I checked my version of anova2 and it came back essentially as you described. When I wrote my question, I had the experience that when I used the example in the documentation I received MATLAB output different than the documentation. This morning I loaded the popcorn data and everything exactly matched with the documented example. I also manually entered the data, gave it a new variable name, and ran the analysis again, also observing an exact match with the documentation. I truly don't understand what happened last week, because that same sequence of events gave me output that was dramatically different than the example.

I am fully aware that it is bad form to waste the forum's time. I've received excellent assistance here in the past and try to be very careful not be too casual with other people's time. Perhaps it was operator error, but I don't think so. Anyway, it seems to be working properly at the moment, so I will close this question. Thank you for your help.

Mark

Wayne King

Contact us