Jean-Pierre Bresciani
2008-Aug-27 10:23 UTC
[R] random error with lme for repeated measures anova
Hi, what is the appropriate syntax to get the random error correct when performing repeated measures anova with 'lme'. let's say i have 3 independent variables, with 'aov', i would write something like: aov(dep_var~(indep_var1*indep_var2*indep_var3) + Error(subject/(indep_var1*indep_var2*indep_var3)). With 'lme' however, i can't find the right formula. i tried things like: lme(dep_var~(indep_var1*indep_var2*indep_var3), random = ~1|subject) or nesting my independent variables in 'subject', but those are obviously wrong with my design. i'm quite clueless (and i haven't found any convincing piece of information about how to correctly use 'lme' or 'lmer'). So, any advice along that line is more than welcome. JP -- View this message in context: http://www.nabble.com/random-error-with-lme-for-repeated-measures-anova-tp19178239p19178239.html Sent from the R help mailing list archive at Nabble.com.
Andrew Robinson
2008-Aug-27 10:32 UTC
[R] random error with lme for repeated measures anova
Hi JP,
I suggest that you read the literature cited in the help file, most
particularly
Pinheiro, J.C., and Bates, D.M. (2000) "Mixed-Effects Models in S
and S-PLUS", Springer.
MASS (Modern Applied Statistics in S) also has some useful things in
it.
Cheers
Andrew
On Wed, Aug 27, 2008 at 03:23:58AM -0700, Jean-Pierre Bresciani
wrote:>
> Hi,
>
> what is the appropriate syntax to get the random error correct when
> performing repeated measures anova with 'lme'.
>
> let's say i have 3 independent variables, with 'aov', i would
write
> something like: aov(dep_var~(indep_var1*indep_var2*indep_var3) +
> Error(subject/(indep_var1*indep_var2*indep_var3)).
>
> With 'lme' however, i can't find the right formula. i tried
things like:
> lme(dep_var~(indep_var1*indep_var2*indep_var3), random = ~1|subject) or
> nesting my independent variables in 'subject', but those are
obviously wrong
> with my design.
>
> i'm quite clueless (and i haven't found any convincing piece of
information
> about how to correctly use 'lme' or 'lmer'). So, any advice
along that line
> is more than welcome.
>
> JP
> --
> View this message in context:
http://www.nabble.com/random-error-with-lme-for-repeated-measures-anova-tp19178239p19178239.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
--
Andrew Robinson
Department of Mathematics and Statistics Tel: +61-3-8344-6410
University of Melbourne, VIC 3010 Australia Fax: +61-3-8344-4599
http://www.ms.unimelb.edu.au/~andrewpr
http://blogs.mbs.edu/fishing-in-the-bay/
Hi Jean-Pierre, A general comment is that I think you need to think more carefully about what you are trying to get out of your analysis. The random effects structure you are aiming for could be stretching your data a little thin. It might be a good idea to read through the archives of the R-sig-mixed-models mailing list https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models This should give you a better idea of some of the issues involved. If you can't source the source (P&B) then there are other documents that might help. You could begin by locationing the directory where nlme package is installed and looking at the scripts in the scripts subdirectory. These are from P&B. Baayen has the following draft document on his website. Though DRAFT'ed all over the place, it is well worth a read, even if you are not interested in linguistic analysis. I think it has now been published by Cambridge UP. http://www.ualberta.ca/~baayen/publications/baayenCUPstats.pdf Paul Bliese's document (Multilevel Modeling in R) also has some useful sections (find it under the contributed documents section on CRAN). HTH, Mark. Jean-Pierre Bresciani wrote:> > Hi, > > what is the appropriate syntax to get the random error correct when > performing repeated measures anova with 'lme'. > > let's say i have 3 independent variables, with 'aov', i would write > something like: aov(dep_var~(indep_var1*indep_var2*indep_var3) + > Error(subject/(indep_var1*indep_var2*indep_var3)). > > With 'lme' however, i can't find the right formula. i tried things like: > lme(dep_var~(indep_var1*indep_var2*indep_var3), random = ~1|subject) or > nesting my independent variables in 'subject', but those are obviously > wrong with my design. > > i'm quite clueless (and i haven't found any convincing piece of > information about how to correctly use 'lme' or 'lmer'). So, any advice > along that line is more than welcome. > > JP >-- View this message in context: http://www.nabble.com/random-error-with-lme-for-repeated-measures-anova-tp19178239p19180027.html Sent from the R help mailing list archive at Nabble.com.