2
$\begingroup$

Is it possible to extract the cell means from an ANOVA result so one can plot them? I can extract the cell means using Part but I am not able to plot that information using ListPlot. Any suggestions would be greatly appreciated.

Use the following as an example...

Needs["ANOVA`"];
ANOVA[{
       {1, 1, 2}, {1, 1, 3}, {1, 2, 4}, {1, 2, 3}, 
       {2, 1, 5}, {2, 1, 4}, {2, 2, 4}, {2, 2, 2}}
      }, {x, y}, {x, y}]
$\endgroup$
  • 1
    $\begingroup$ Can you provide some sample code to see what you are dealing with specifically? $\endgroup$ – MarcoB Oct 1 '15 at 2:21
  • $\begingroup$ Will that work? $\endgroup$ – Steven Anderson Oct 1 '15 at 3:07
5
$\begingroup$
Needs["ANOVA`"]

anovaresults = 
  ANOVA[{{1, 1, 2}, {1, 1, 3}, {1, 2, 4}, {1, 2, 3}, {2, 1, 5}, {2, 1, 4}, {2, 2, 4}, {2, 2, 2}}, {x, y}, {x, y}];

To plot all of them:

ListPlot[anovaresults[[2, 2, 1, All, 2]]]

Mathematica graphics

... or only the ones corresponding to x[1], x[2], y[1], y[2]:

ListPlot[anovaresults[[2, 2, 1, 2 ;;, 2]]]

Mathematica graphics

$\endgroup$
  • $\begingroup$ This is awesome. thank you. I got to the [2,2,1] level but didn't know how to "drill" down to the actual values like you did. $\endgroup$ – Steven Anderson Oct 1 '15 at 5:42
  • $\begingroup$ @StevenAnderson Glad it helps! Thanks for the accept as well. $\endgroup$ – MarcoB Oct 1 '15 at 5:50
  • 1
    $\begingroup$ @StevenAnderson Also, note that you can get the list of CellMeans for further manipulations by First[CellMeans /.ANOVA[...]]. $\endgroup$ – yohbs Oct 1 '15 at 10:20
  • $\begingroup$ @yohbs - thank you. $\endgroup$ – Steven Anderson Oct 2 '15 at 0:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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