[R] lme degrees of freedoms: SAS and R

Kaiya Liu liu.262 at osu.edu
Fri Mar 31 12:38:49 CEST 2000


Dear list,

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

-----------------------------------------------------------
Kaiya Liu
School of Journalism and Communication
Ohio State University

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