Re: [R] Help please! How to code a mixed-model with 2 within-subject factors using lme or lmer?

2008-09-15 Thread Mark Difford
Hi Roberto, The other thing you can do --- if you don't wish to step across to lmer(), where you will be able to exactly replicate the crossed-factor error structure --- is stay with aov(... + Error()), but fit the factor you are interested in last. Assume it is Sex. Then fit your model as

[R] Help please! How to code a mixed-model with 2 within-subject factors using lme or lmer?

2008-09-14 Thread roberto toro
Hello, I'm using aov() to analyse changes in brain volume between males and females. For every subject (there are 331 in total) I have 8 volume measurements (4 different brain lobes and 2 different tissues (grey/white matter)). The data looks like this: Subject Sex LobeTissue Volume

Re: [R] Help please! How to code a mixed-model with 2 within-subject factors using lme or lmer?

2008-09-14 Thread Mark Difford
Hi Roberto, but I can't figure out the /(Lobe*Tissue) part... This type of nesting is easier to do using lmer(). To do it using lme() you have to generate the crossed factor yourself. Do something like this: ## tfac - with(vslt, interaction(Lobe, Tissue, drop=T)) str(tfac); head(tfac)

[R] Help please! How to code a mixed-model with 2 within-subject factors using lme or lmer?

2008-09-14 Thread roberto toro
Thanks for answering Mark! I tried with the coding of the interaction you suggested: tfac-with(vlt,interaction(Lobe,Tissue,drop=T)) mod-lme(Volume~Sex*Lobe*Tissue,random=~1|Subject/tfac,data=vlt) But is it normal that the DF are 2303? DF is 2303 even for the estimate of LobeO that has only

Re: [R] Help please! How to code a mixed-model with 2 within-subject factors using lme or lmer?

2008-09-14 Thread Mark Difford
Hi Roberto, It's difficult to comment further on specifics without access to your data set. A general point is that the output from summary(aov.object) is not directly comparable with summary(lme.object). The latter gives you a summary of a fitted linear regression model, not an analysis of