[R] proc mixed vs. lme

Grathwohl,Dominik,LAUSANNE,NRC/NT dominik.grathwohl at rdls.nestle.com
Wed Oct 9 13:31:42 CEST 2002


Hallo Peter,

Thank you for the advice, now I have to update my table:

                            SAS                           R
random statement            random subj(program);         random = ~ 1 |
Subj
-2*loglik                   1420.8                        1420.820
random effects
variance(Intercept)         9.6033                        9.603331
variance(residual)          1.1969                        1.196873
the first 3 fixed effects
intercept                   83.0952                        83.09524
ProgramCont                -3.4952                       -3.49524
ProgramRI                  -1.9702                       -1.97024
...                        ...                            ...

Everything looks nice. Perhaps Douglas could update the help file in
SASmixed, 
where I copied the misleading code!

Kind regards,

Dominik

> -----Original Message-----
> From: Peter Dalgaard BSA [mailto:p.dalgaard at biostat.ku.dk]
> Sent: mercredi, 9. octobre 2002 12:37
> To: Grathwohl,Dominik,LAUSANNE,NRC/NT
> Subject: Re: [R] proc mixed vs. lme
> 
> 
> "Grathwohl,Dominik,LAUSANNE,NRC/NT" 
> <dominik.grathwohl at rdls.nestle.com> writes:
> 
> > Comparing linear mixed effect models in SAS and R, I found 
> the following
> > discrepancy:
> > 
> >                             SAS                           R
> > random statement            random subj(program);         
> random = ~ 1 |
> > Subj
> > -2*loglik                   1420.8                        1439.363
> > random effects
> > variance(Intercept)         9.6033                        9.604662
> > variance(residual)          1.1969                        1.187553
>  
> ...
> 
> 
> > #The R code:
> > 
> > library(nlme)
> > library(SASmixed)
> > options( contrasts = c(unordered = "contr.SAS", ordered = 
> contr.poly")) 
> > data(Weights) 
> > fm1Weight <- lme( strength ~ Program * Time, data = 
> Weights, random = ~ 1 |
> > Subj) 
> > summary( fm1Weight )
> > VarCorr( fm1Weight ) 
> 
> It helps considerably if you fit the same model! Try:
> 
> fm1Weight <- lme( strength ~ factor(Program) * factor(Time), 
>       data = Weights, random = ~ 1 | Subj) 
> 
> (or change the variables from numeric to factor inside Weights).
> 
> -- 
>    O__  ---- Peter Dalgaard             Blegdamsvej 3  
>   c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
>  (*) \(*) -- University of Copenhagen   Denmark      Ph: 
> (+45) 35327918
> ~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)             FAX: 
> (+45) 35327907
> 
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list