[R] basic question on getGroups for lme analyses

Francisco J. Zagmutt Vergara fzagmutt at hotmail.com
Thu May 22 16:46:13 CEST 2003


As far as I know GetGroups is designed to extract grouping factors from an 
object, not to create them . To do so you can either specify your hierarchy 
in the random argument of your lme model .i.e. m1<-lme(distance~age, 
data=Orthodont, random = ~age|Subject)

or you can also create grouped data using groupedData.i.e:

groupedData( distance ~ age | Subject,
                   data = as.data.frame( Orthodont ),
                   FUN = mean,
                   outer = ~ Sex,
                   labels = list( x = "Age",
                     y = "Distance from pituitary to pterygomaxillary 
fissure" ),
                   units = list( x = "(yr)", y = "(mm)") )

     plot( Orth.new )         # trellis plot by Subject

     formula( Orth.new )      # extractor for the formula
     gsummary( Orth.new )     # apply summary by Subject
     fm1 <- lme( Orth.new )   # fixed and groups formulae extracted from 
object
     Orthodont2 <- update(Orthodont, FUN = mean)





>From: "Jose A. Andres" <joseandres at uvigo.es>
>To: <r-help at stat.math.ethz.ch>
>Subject: [R] basic question on getGroups for lme analyses
>Date: Thu, 22 May 2003 14:02:44 +0200
>
>Hi all!
>
>I am working on a nested lme model with one fixed effect ("treatment", 
>which 3 levels) and two random effects for "Individuals" (four of them) 
>within "treatment" and "replicate -2 levels-" within "individual" within 
>"treatment". For doing so, I´ve been trying to create a factor for 
>Individual%in%Treatment, say IT
>by
>
>Hongos$IT=getGroups(~1|Treatment/Individual, data=hongos1, level=4)
>
>but I got the following error:
>
>Error in getGroups(~1 | Treatment/Individual, data = hongos1, level = 4) :
>         no applicable method for "getGroups"
>
>I've been trying some other things but nothing seem to work, probably 
>because I cannot fully understand how o use the getGroups command. Any 
>suggestions?
>
>Thanks a lot!
>
>/Jose
>
>
>
>	[[alternate HTML version deleted]]
>
>______________________________________________
>R-help at stat.math.ethz.ch mailing list
>https://www.stat.math.ethz.ch/mailman/listinfo/r-help




More information about the R-help mailing list