Philip Turk
2003-Dec-05 17:49 UTC
[R] Can anyone help me reproduce this SAS Mixed output??
I asked this before and I am going to try again in more applied terms. I am trying to use R to extract variance components for a two-factor random effects model with both factors crossed. It would also be nice to generate some confidence intervals as well. For example, a data set using SAS Proc Mixed is below followed by the four variance component estimates and the respective confidence intervals. Currently, I have been unable to reproduce this in NLME but I am sure I have not correctly specified the "random" option. Any help and/or ideas would be greatly appreciated! ## SAS PROGRAM WITH DATA FOLLOWS data hw7; input mpg driver car obs; cards; 25.3 1 1 1 25.2 1 1 2 28.9 1 2 1 30 1 2 2 24.8 1 3 1 25.1 1 3 2 28.4 1 4 1 27.9 1 4 2 27.1 1 5 1 26.6 1 5 2 33.6 2 1 1 32.9 2 1 2 36.7 2 2 1 36.5 2 2 2 31.7 2 3 1 31.9 2 3 2 35.6 2 4 1 35 2 4 2 33.7 2 5 1 33.9 2 5 2 27.7 3 1 1 28.5 3 1 2 30.7 3 2 1 30.4 3 2 2 26.9 3 3 1 26.3 3 3 2 29.7 3 4 1 30.2 3 4 2 29.2 3 5 1 28.9 3 5 2 29.2 4 1 1 29.3 4 1 2 32.4 4 2 1 32.4 4 2 2 27.7 4 3 1 28.9 4 3 2 31.8 4 4 1 30.7 4 4 2 30.3 4 5 1 29.9 4 5 2 ; proc mixed data = hw7 method = reml cl asycov; class driver car; model mpg =; random driver car driver*car; run; quit; ## SELECTED OUTPUT FOLLOWS Covariance Parameter Estimates Cov Parm Estimate Alpha Lower Upper driver 9.3224 0.05 2.9864 130.79 car 2.9343 0.05 1.0464 24.9038 driver*car 0.01406 0.05 0.001345 3.592E17 Residual 0.1757 0.05 0.1029 0.3665
Spencer Graves
2003-Dec-06 16:13 UTC
[R] Can anyone help me reproduce this SAS Mixed output??
Have you also tried "intervals" on the output of "nlme"? I have not used "nlme", but it works in "lme". Also, have you looked at Pinhiero and Bates (2000) Mixed-Effects Models in S and S-PLUS (Springer)? I had to read and carefully work through a portion of this book before I was able to use "lme" successfully. However, I found it well worth the effort, both for how to use "lme" and for understanding the theory behind it. Bates and his graduate students including Pinhiero wrote "lme" and "nlme", and I know of no better source on this subject. hope this helps. spencer graves Philip Turk wrote:>I asked this before and I am going to try again in more applied terms. I >am trying to use R to extract variance components for a two-factor random >effects model with both factors crossed. It would also be nice to >generate some confidence intervals as well. For example, a data set >using SAS Proc Mixed is below followed by the four variance component >estimates and the respective confidence intervals. Currently, I have been >unable to reproduce this in NLME but I am sure I have not correctly >specified the "random" option. > >Any help and/or ideas would be greatly appreciated! > >## SAS PROGRAM WITH DATA FOLLOWS > >data hw7; >input mpg driver car obs; >cards; >25.3 1 1 1 >25.2 1 1 2 >28.9 1 2 1 >30 1 2 2 >24.8 1 3 1 >25.1 1 3 2 >28.4 1 4 1 >27.9 1 4 2 >27.1 1 5 1 >26.6 1 5 2 >33.6 2 1 1 >32.9 2 1 2 >36.7 2 2 1 >36.5 2 2 2 >31.7 2 3 1 >31.9 2 3 2 >35.6 2 4 1 >35 2 4 2 >33.7 2 5 1 >33.9 2 5 2 >27.7 3 1 1 >28.5 3 1 2 >30.7 3 2 1 >30.4 3 2 2 >26.9 3 3 1 >26.3 3 3 2 >29.7 3 4 1 >30.2 3 4 2 >29.2 3 5 1 >28.9 3 5 2 >29.2 4 1 1 >29.3 4 1 2 >32.4 4 2 1 >32.4 4 2 2 >27.7 4 3 1 >28.9 4 3 2 >31.8 4 4 1 >30.7 4 4 2 >30.3 4 5 1 >29.9 4 5 2 >; > >proc mixed data = hw7 method = reml cl asycov; >class driver car; >model mpg =; >random driver car driver*car; >run; >quit; > >## SELECTED OUTPUT FOLLOWS > >Covariance Parameter Estimates > >Cov Parm Estimate Alpha Lower Upper > >driver 9.3224 0.05 2.9864 130.79 >car 2.9343 0.05 1.0464 24.9038 >driver*car 0.01406 0.05 0.001345 3.592E17 >Residual 0.1757 0.05 0.1029 0.3665 > >______________________________________________ >R-help at stat.math.ethz.ch mailing list >https://www.stat.math.ethz.ch/mailman/listinfo/r-help > >