[R] lme degrees of freedoms: SAS and R

John Fox jfox at mcmaster.ca
Mon Apr 1 00:21:44 CEST 2002


Dear Kaiya Liu,

I don't have time now to check, but as I recall, the default "containment 
method" for determining degrees of freedom used by proc mixed in SAS 
doesn't always give the right answer. You can try adding ddfm=satterth as 
an option to the model statement to use Satterthwaite's method for 
calculating df. Again, if I recall right, there's a discussion in the book 
The SAS System for Mixed Models by Littell et al.

Maybe this accounts for the discrepancy.

I hope that this helps,
  John

At 12:52 PM 3/31/2002 +0200, Kaiya Liu wrote:

>I ran a mixed effect model using R 1.4.1 and SAS 8.0 on the SIMS data 
>found in the SASmixed package and found that the degrees of freedoms for 
>fixed effects are very different.
> From R, df = n - v -1 where n is total # of observations, v is the # of 
> levels for the grouping factor. From SAS df = v -1. Am I wrong about this 
> or can somebody explain which is correct and why?
>
>Thanks a lot!
>
>Kaiya Liu
>
>-------------------------------------
>Here are the codes:
>
>For R:
> > formula (SIMS)
>Gain ~ Pretot | Class
> > data(SIMS)
> > fm1SIMS <- lme(Gain ~ Pretot, data = SIMS, random = ~ Pretot | Class, 
> control = list(msVerbose = TRUE))
> > summary (fm1SIMS)
>_________________________________
>For SAS:
>
>proc mixed data=sims;
>    class class;
>    model gain = pretot / solution;
>    random intercept pretot / subject=class type=un;
>run;
>
>Most of the results are comparable except the degrees of freedoms for the 
>fixed effects:
>
> From R: DF = 3500
>
>Fixed effects: Gain ~ Pretot
>                 Value Std.Error   DF   t-value p-value
>(Intercept)  7.066218 0.3631916 3500  19.45589  <.0001
>Pretot      -0.187538 0.0163680 3500 -11.45756  <.0001
>
>Number of Observations: 3691
>Number of Groups: 190
>__________________________________________________________
> From SAS: DF = 189
>
>                     Solution for Fixed Effects
>
>                                          Standard
>                 Effect       Estimate       Error      DF    t 
> Value    Pr > |t|
>
>                 Intercept      7.0595      0.3658     189      19.30 <.0001
>                 pretot        -0.1860     0.01610     189     -11.56 <.0001
>
>-----------------------------------------------------------

-----------------------------------------------------
John Fox
Department of Sociology
McMaster University
Hamilton, Ontario, Canada L8S 4M4
email: jfox at mcmaster.ca
phone: 905-525-9140x23604
web: www.socsci.mcmaster.ca/jfox
-----------------------------------------------------

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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