[R] lme funcion in R

Chuck Cleland ccleland at optonline.net
Mon Aug 3 19:26:22 CEST 2009


On 8/3/2009 1:15 PM, Hongwei Dong wrote:
> Hi, R users,
>   I'm using the "lme" function in R to estimate a 2 level mixed effects
> model, in which the size of the subject groups are different. It turned out
> that It takes forever for R to converge. I also tried the same thing in SPSS
> and SPSS can give the results out within 20 minutes. Anyone can give me some
> advice on the lme function in R, especially why R does not converge? Thanks.

Harry:
  You are much more likely to get helpful advice if you include the code
you used to attempt to fit the model and a brief description of the
data.  For example, something along these lines but for your data and model:

library(nlme)

fm2 <- lme(distance ~ age + Sex, data = Orthodont, random = ~ 1)

str(Orthodont)

Classes ‘nfnGroupedData’, ‘nfGroupedData’, ‘groupedData’ and
'data.frame':      108 obs. of  4 variables:
 $ distance: num  26 25 29 31 21.5 22.5 23 26.5 23 22.5 ...
 $ age     : num  8 10 12 14 8 10 12 14 8 10 ...
 $ Subject : Ord.factor w/ 27 levels "M16"<"M05"<"M02"<..: 15 15 15 15 3
3 3 3 7 7 ...
 $ Sex     : Factor w/ 2 levels "Male","Female": 1 1 1 1 1 1 1 1 1 1 ...
 - attr(*, "outer")=Class 'formula' length 2 ~Sex
  .. ..- attr(*, ".Environment")=<environment: R_GlobalEnv>
 - attr(*, "formula")=Class 'formula' length 3 distance ~ age | Subject
  .. ..- attr(*, ".Environment")=<environment: R_GlobalEnv>
 - attr(*, "labels")=List of 2
  ..$ x: chr "Age"
  ..$ y: chr "Distance from pituitary to pterygomaxillary fissure"
 - attr(*, "units")=List of 2
  ..$ x: chr "(yr)"
  ..$ y: chr "(mm)"
 - attr(*, "FUN")=function (x)
  ..- attr(*, "source")= chr "function (x) max(x, na.rm = TRUE)"
 - attr(*, "order.groups")= logi TRUE

hope this helps,

Chuck

> Harry
> 
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> 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. 

-- 
Chuck Cleland, Ph.D.
NDRI, Inc. (www.ndri.org)
71 West 23rd Street, 8th floor
New York, NY 10010
tel: (212) 845-4495 (Tu, Th)
tel: (732) 512-0171 (M, W, F)
fax: (917) 438-0894




More information about the R-help mailing list