Sorry, by mistake I sent this to Professor Bates instead of r-help.
Han
-------- Original Message --------
Subject: Re: [R] degrees of freedom for t-tests in lme
Date: Thu, 25 Apr 2002 09:16:16 -0700
From: Han-Lin Lai <Han-Lin.Lai at noaa.gov>
To: Douglas Bates <bates at stat.wisc.edu>
References: <3CC6E87F.5400277D at noaa.gov>
<6rg01lottu.fsf at franz.stat.wisc.edu>
Thank you very much for the answer. I find that there is couple typo in
my
data. Now I get the correct results from fitting the model:
lme(y~x+log(den)+sex+dep,data=lwd,random= list(group=~x))
numDF denDF F-value p-value
(Intercept) 1 3209 17660.85 <.0001
x 1 3209 6411.56 <.0001
sex 1 3209 12.07 0.0005
dep 3 22 25.10 <.0001
Fixed effects: y ~ x + sex + dep
Value Std.Error DF t-value
p-value
(Intercept) -11.24380 0.1725474 3209 -65.16353 <.0001
x 3.05784 0.0382305 3209 79.98440 <.0001
sex 0.01958 0.0057823 3209 3.38548 0.0007
depD27 0.01382 0.0593448 22 0.23293 0.8180
depD35 -0.06537 0.0550606 22 -1.18723 0.2478
depD50 -0.28581 0.0557979 22 -5.12220 <.0001
However, my real questions is: How DF = 3209 and 22 are calculated? I
follow
the book by Pinheiro and Bates (2000, p.91),
Q = 1
mo=1 because I have intercept in model
m1=26 groups
m2=3237 observations
p0=1
p1=3, (I have 4 levels of dep's, therefore, it is 4-1. Isn't it?)
p2=??
Then, DF for dep is 26-(1+3)=22. Following this way, p2 = 2 so the DF
for
intercept, x, and sex is 3237-(26+2)=3209. How is p2 determined?
Thanks for the help.
Han
Douglas Bates wrote:
> Han-Lin Lai <Han-Lin.Lai at noaa.gov> writes:
>
> > I have trouble to figure out how the df is derived in LME. Here is my
> > model,
> >
> > lme(y~x+log(den)+sex+dep,data=lwd,random= list(group=~x))
> >
> > Number of total samples (N) is 3237
> > number of groups (J) is 26
> > number of level-1 variables (Q1) is 3, i.e., x, log(den) and sex
> > number of level-2 variables (Q2) is 1, i.e., dep
> > x and den are continuous variable
> > sex is associated with individual samples and has 2 levels
> > dep is associated with group has 4 levels: depD15, depD27, and depD35,
> > and depD35.
> >
> > I got the results:
> >
> > Fixed effects: y ~ x + log(den) + sex + dep
> > Value Std.Error DF t-value p-value
> > (Intercept) -11.29271 0.1681915 3206 -67.14200 <.0001
> > x 3.05937 0.0367970 3206 83.14182 <.0001
> > log(den) 0.00898 0.0022357 3206 4.01732 0.0001
> > sex 0.01980 0.0057675 3206 3.43216 0.0006
> > depD27 -0.01505 0.0560142 3206 -0.26872 0.7882
> > depD35 -0.06102 0.0548647 3206 -1.11227 0.2661
> > depD50 -0.29123 0.0567132 24 -5.13511 <.0001
> >
> > Are these coefficients are the level-2, and thus, DF for testing
dep's
> > should be (J-Q2_1=26-1-1=24). Why I get the number 3206, especially
for
> > depD27 depD35 and depD50.
> >
> > Thanks
> > Han
> > Han-Lin.Lai at noaa.gov
>
> By saying that dep is a level-2 variable do you mean that it does not
> change within groups? Have you checked that, say by
>
> gsummary(mydata, form = ~ group, invariants = TRUE)
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._