[R] Variance Components in R

Spencer Graves spencer.graves at pdf.com
Thu Aug 17 02:34:58 CEST 2006


      I used SPSS over 25 years ago, but I don't recall ever fitting a 
variance components model with it.  Are all your random effects nested?  
If they were, I would recommend you use 'lme' in the 'nlme' package.  
However, if you have crossed random effects, I suggest you try 'lmer' 
associated with the 'lme4' package. 

      For 'lmer', documentation is available in Douglas Bates. Fitting 
linear mixed models in R. /R News/, 5(1):27-30, May 2005 
(www.r-project.org -> newsletter).  I also recommend you try the 
vignette available with the 'mlmRev' package (see, e.g., 
http://finzi.psych.upenn.edu/R/Rhelp02a/archive/81375.html). 

       Excellent documentation for both 'lme' (and indirectly for 
'lmer') is available in Pinheiro and Bates (2000) Mixed-Effects Models 
in S and S-Plus (Springer).  I have personally recommended this book so 
many times on this listserve that I just now got 234 hits for 
RSiteSearch("graves pinheiro").  Please don't hesitate to pass this 
recommendation to your university library.  This book is the primary 
documentation for the 'nlme' package, which is part of the standard R 
distribution.  A subdirectory "~library\nlme\scripts" of your R 
installation includes files named "ch01.R", "ch02.R", ..., "ch06.R", 
"ch08.R", containing the R scripts described in the book.  These R 
script files make it much easier and more enjoyable to study that book, 
because they make it much easier to try the commands described in the 
book, one line at a time, testing modifications to check you 
comprehension, etc.  In addition to avoiding problems with typographical 
errors, it also automatically overcomes a few minor but substantive 
changes in the notation between S-Plus and R. 

      Also, the "MINQUE" method has been obsolete for over 25 years.  I 
recommend you use method = "REML" except for when you want to compare 
two nested models with different fixed effects;  in that case, you 
should use method = "ML", as explained in Pinheiro and Bates (2000). 

      Hope this helps. 
      Spencer Graves

Iuri Gavronski wrote:
> Hi,
>
> I'm trying to fit a model using variance components in R, but if very  
> new on it, so I'm asking for your help.
>
> I have imported the SPSS database onto R, but I don't know how to  
> convert the commands... the SPSS commands I'm trying to convert are:
> VARCOMP
>    RATING BY CHAIN SECTOR RESP ASPECT ITEM
>    /RANDOM = CHAIN SECTOR RESP ASPECT ITEM
>    /METHOD = MINQUE (1)
>    /DESIGN = CHAIN SECTOR RESP ASPECT ITEM
>                SECTOR*RESP SECTOR*ASPECT SECTOR*ITEM CHAIN*RESP  
> CHAIN*ASPECT CHAIN*ITEM RESP*ASPECT RESP*ITEM
>                SECTOR*RESP*ASPECT SECTOR*RESP*ITEM CHAIN*RESP*ASPECT
>    /INTERCEPT = INCLUDE.
>
> VARCOMP
>    RATING BY CHAIN SECTOR RESP ASPECT ITEM
>    /RANDOM = CHAIN SECTOR RESP ASPECT ITEM
>    /METHOD = REML
>    /DESIGN = CHAIN SECTOR RESP ASPECT ITEM
>                SECTOR*RESP SECTOR*ASPECT SECTOR*ITEM CHAIN*RESP  
> CHAIN*ASPECT CHAIN*ITEM RESP*ASPECT RESP*ITEM
>                SECTOR*RESP*ASPECT SECTOR*RESP*ITEM CHAIN*RESP*ASPECT
>    /INTERCEPT = INCLUDE.
>
> Thank you for your help.
>
> Best regards,
>
> Iuri.
>
> _______________________________________
> Iuri Gavronski - iuri at ufrgs.br
> doutorando
> UFRGS/PPGA/NITEC - www.ppga.ufrgs.br
> Brazil
>
> ______________________________________________
> R-help at 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
> and provide commented, minimal, self-contained, reproducible code.
>



More information about the R-help mailing list