[R] Plotting 3 way Anova

Richard M. Heiberger rmh at temple.edu
Sun Aug 24 20:27:57 CEST 2008


Heidi,

The interaction2wt function in the HH package does much of what you are
looking for.
You will probably need to download HH from CRAN.

interaction2wt {HH} R Documentation 

Plot all main effects and twoway interactions in a multifactor design
Description
The main diagonal displays boxplots for the main effects of each factor. The
off-diagonals
show the interaction plots for each pair of factors. The i,j panel shows the
same factors
as the j,i but with the trace- and x-factor roles interchanged. 


The second page of 
  example(interaction2wt)
shows the simple effects of each factor in the presence of the other.

In your example, "condition on the Y axis and year along the
X axis and four bars for each year to show mean ci for each sex and age
group".
I think
   interaction2wt(Y ~ year + interaction(sex, age), simple=TRUE,
data=yourdataframe)
will show what you are looking for.

Please send executable code to the entire list if there are followup
questions.


Rich



More information about the R-help mailing list