Hi Paul,

Note that in your example subject/myfactor is conflated with the error
term.  The error thrown when you use intervals on the lme object is a
result:

> am2 <- lme(dv ~ myfactor, random = ~1|subject/myfactor, data=mydata)
> intervals(am2)
Error in intervals.lme(am2) :
  Cannot get confidence intervals on var-cov components: Non-positive
definite approximate variance-covariance


Also it's worth pointing out that the REML approach used by lme has
some advantages.  For example:

- It is not sensitve to lack of balance in the design
- Variance estimates are restricted to the parameter space (i.e. no
negative variance estimates)
- Allows for estimation of parameters to model non-constant variance
within or between subjects via the weights argument.
- The correlation argument allows for estimation of correlation
structures when, for example, observations within subjects are
temporally or spatially correlated.

Kingsford Jones





On Mon, Mar 9, 2009 at 1:15 PM, Paul Gribble <pgrib...@uwo.ca> wrote:
> After much research I've listed a couple of ways to do repeated measures
> anova here:
>
> http://gribblelab.org/2009/03/09/repeated-measures-anova-using-r/
>
> including univariate and multivariate methods, post-hoc tests, sphericity
> test, etc.
>
> It appears to me that the most useful way is a multivariate model and then
> using Anova() from the car package.
>
> -Paul
>
>
> On Tue, Mar 3, 2009 at 5:37 PM, Paul Gribble <pgrib...@uwo.ca> wrote:
>
>> Have a look at
>>>
>>> http://cran.r-project.org/doc/Rnews/Rnews_2007-2.pdf
>>>
>>
>> Wow. I think my students would keel over.
>>
>>
>> Anova() from the car package looks promising - I will check it out. Thanks
>>
>>
>>
>> On Tue, Mar 3, 2009 at 4:00 PM, Peter Dalgaard 
>> <p.dalga...@biostat.ku.dk>wrote:
>>
>>> Paul Gribble wrote:
>>>
>>>> I have 3 questions (below).
>>>>
>>>> Background: I am teaching an introductory statistics course in which we
>>>> are
>>>> covering (among other things) repeated measures anova. This time around
>>>> teaching it, we are using R for all of our computations. We are starting
>>>> by
>>>> covering the univariate approach to repeated measures anova.
>>>>
>>>> Doing a basic repeated measures anova (univariate approach) using aov()
>>>> seems straightforward (e.g.:
>>>>
>>>> +> myModel<-aov(myDV~myFactor+Error(Subjects/myFactor),data=myData)
>>>> +> summary(myModel)
>>>>
>>>> Where I am currently stuck is how best to deal with the issue of the
>>>> assumption of homogeneity of treatment differences (in other words, the
>>>> sphericity assumption) - both how to test it in R and how to compute
>>>> corrected df for the F-test if the assumption is violated.
>>>>
>>>> Back when I taught this course using SPSS it was relatively
>>>> straightforward
>>>> - we would look at Mauchly's test of sphericity - if it was significant,
>>>> then we would use one of the corrected F-tests (e.g. Greenhouse-Geisser
>>>> or
>>>> Huynh-Feldt) that were spat out automagically by SPSS.
>>>>
>>>> I gather from searching the r-help archives, searching google, and
>>>> searching
>>>> through various books on R, that the only way of using mauchly.test() in
>>>> R
>>>> is on a multivariate model object (e.g. mauchly.test cannot handle an
>>>> aov()
>>>> object).
>>>>
>>>> Question 1: how do you (if you do so), test for sphericity in a repeated
>>>> measures anova using R, when using aov()? (or do you test the sphericity
>>>> assumption using a different method)?
>>>>
>>>> Question 2: Can someone point me to an example (on the web, in a book,
>>>> wherever) showing how to perform a repeated measures anova using the
>>>> multivariate approach in R?
>>>>
>>>> Question 3: Are there any existing R functions for calculating adjusted
>>>> df
>>>> for Greenhouse-Geisser, Huynh-Feldt (or calculating epsilon), or is it up
>>>> to
>>>> me to write my own function?
>>>>
>>>> Thanks in advance for any suggestions,
>>>>
>>>
>>> Have a look at
>>>
>>> http://cran.r-project.org/doc/Rnews/Rnews_2007-2.pdf
>>>
>>> Last time this came up, John Fox also pointed to some of his stuff, see
>>> http://finzi.psych.upenn.edu/R/Rhelp08/archive/151282.html
>>>
>>> --
>>>   O__  ---- Peter Dalgaard             Øster Farimagsgade 5, Entr.B
>>>  c/ /'_ --- Dept. of Biostatistics     PO Box 2099, 1014 Cph. K
>>>  (*) \(*) -- University of Copenhagen   Denmark      Ph:  (+45) 35327918
>>> ~~~~~~~~~~ - (p.dalga...@biostat.ku.dk)              FAX: (+45) 35327907
>>>
>>
>>
>>
>> --
>> Paul L. Gribble, Ph.D.
>> Associate Professor
>> Dept. Psychology
>> The University of Western Ontario
>> London, Ontario
>> Canada N6A 5C2
>> Tel. +1 519 661 2111 x82237
>> Fax. +1 519 661 3961
>> pgrib...@uwo.ca
>> http://gribblelab.org
>>
>
>
>
> --
> Paul L. Gribble, Ph.D.
> Associate Professor
> Dept. Psychology
> The University of Western Ontario
> London, Ontario
> Canada N6A 5C2
> Tel. +1 519 661 2111 x82237
> Fax. +1 519 661 3961
> pgrib...@uwo.ca
> http://gribblelab.org
>
>        [[alternative HTML version deleted]]
>
>
> ______________________________________________
> R-help@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.
>
>

______________________________________________
R-help@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.

Reply via email to