Re: [R] can nlme do the complex multilevel model?

From: Spencer Graves <spencer.graves_at_pdf.com>
Date: Fri 10 Jun 2005 - 03:15:38 EST

          The documentation for "lme" includes the following:

####################################
     lme(fixed, data, random, correlation, weights, subset, method,
         na.action, control, contrasts = NULL)
...
Arguments:
...
 random: optionally, any of the following: (i) a one-sided formula of
          the form '~x1+...+xn | g1/.../gm', with 'x1+...+xn'
          specifying the model for the random effects and 'g1/.../gm'
          the grouping structure
#####################################
	  If you can't figure it out from this and the brief examples in the
help file, I have three other suggestions:

          (1) Have you considered "lmer" in package "lme4"? This function is newer, the specification of random effects is different, and it may or may not be easier to figure out.

          (2) Have you seen Pinheiro and Bates (2000) Mixed-Effects Models in S and S-PLUS (Springer)? This is the definitive documentation on library(nlme). I've learned a lot from this book, and it might help you even if you use "lme4".

          (3) If you still can't figure it out, PLEASE do read the posting guide! "http://www.R-project.org/posting-guide.html". Many people are able to answer their own questions in the course of preparing a question following this guide. If they still submit a question, I believe they are more likely to get a useful reply. In particular, if you submit another question on this, please try to include a self-contained toy example illustrating something you've tried that someone can copy from your email, paste it into R, and test a few minor changes in a matter of seconds.

          spencer graves

ronggui wrote:
> data from multilevel units,first sample the class ,and then the student in calss.following is the 2-level model. and the level-1 model deals with the student,and the level-2 model deals with the class level the students belong to.
>
> Level-1 Model
>
> Y = B0 + B1*(ZLEAD) + B2*(ZBUL) + B3*(ZSHY) + R
>
> Level-2 Model
> B0 = G00 + U0
> B1 = G10 + G11*(ZWARMT) + U1
> B2 = G20 + G21*(ZWARMT) + G22*(ZABLET) + U2
> B3 = G30 + G31*(ZWARMT) + G32*(ZSHYT1) + U3
>
>
> i have seen the ?lme in nlme,but still have no ideal how to do.
>
> ps:i know how to do if the Level-2 Model are:
>
> B0 = G00 + U0
> B1 = G10 + U1
> B2 = G20 + U2
> B3 = G30 + U3
>
>
>
> 2005-06-10
>
> ------
> Deparment of Sociology
> Fudan University
>
> Blog:www.sociology.yculblog.com
>
> ______________________________________________
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Fri Jun 10 03:23:30 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:32:28 EST