[R] how calculation degrees freedom
Douglas Bates
dmbates at gmail.com
Sat Jan 28 00:40:40 CET 2006
On 1/27/06, Søren Højsgaard <Soren.Hojsgaard at agrsci.dk> wrote:
> Degrees of freedom for mixed models is a delicate issue - except in certain orthogonal designs.
>
> However, I'll just point out that for lmer models, there is a simulate() function which can simulate data from a fitted model. simulate() is very fast - just like lmer(). So one way to "get around the problem" could be to evaluate the test statistic (e.g. -2 log Q) in an empirical distribution based on simulations under the model; that is to calculate a Monte Carlo p-value. It is fairly fast to and takes about 10 lines of code to program.
>
> Of course, Monte Carlo p-values have their problems, but the world is not perfect....
Another approach is to use mcmcsamp to derive a sample from the
posterior distribution of the parameters using Markov Chain Monte
Carlo sampling. If you are interested in intervals rather than
p-values the HPDinterval function from the coda package can create
those.
> Along similar lines, I've noticed that the anova() function for lmer models now only reports the mean squares to go into the numerator but "nothing for the denominator" of an F-statistic; probably in recognition of the degree of freedom problem. It could be nice, however, if anova() produced even an approximate anova table which can be obtained from Wald tests. The anova function could then print that "these p-values are large sample ones and hence only approximate"...
I don't think the "degrees of freedom police" would find that to be a
suitable compromise. :-)
>
> Fra: r-help-bounces at stat.math.ethz.ch på vegne af Douglas Bates
> Sendt: fr 27-01-2006 17:06
> Til: gabriela escati peñaloza
> Cc: R-help at stat.math.ethz.ch
> Emne: Re: [R] how calculation degrees freedom
>
>
>
> On 1/27/06, gabriela escati peñaloza <gescati at yahoo.com.ar> wrote:
> > Hi, I' m having a hard time understanding the computation of degrees of freedom
>
> So do I and I'm one of the authors of the package :-)
>
> > when runing nlme() on the following model:
> >
> > > formula(my data.gd)
> > dLt ~ Lt | ID
> >
> > TasavB<- function(Lt, Linf, K) (K*(Linf-Lt))
> >
> > my model.nlme <- nlme (dLt ~ TasavB(Lt, Linf, K),
> > data = my data.gd,
> > fixed = list(Linf ~ 1, K ~ 1),
> > start = list(fixed = c(70, 0.4)),
> > na.action= na.include, naPattern = ~!is.na(dLt))
> >
> > > summary(my model.nlme)
> > Nonlinear mixed-effects model fit by maximum likelihood
> > Model: dLt ~ TasavB(Lt, Linf, K)
> > Data: my data.gd
> > AIC BIC logLik
> > 13015.63 13051.57 -6501.814
> > Random effects:
> > Formula: list(Linf ~ 1 , K ~ 1 )
> > Level: ID
> > Structure: General positive-definite
> > StdDev Corr
> > Linf 7.3625291 Linf
> > K 0.0845886 -0.656
> > Residual 1.6967358
> > Fixed effects: list(Linf + K ~ 1)
> > Value Std.Error DF t-value p-value
> > Linf 69.32748 0.4187314 402 165.5655 <.0001
> > K 0.31424 0.0047690 2549 65.8917 <.0001
> > Standardized Within-Group Residuals:
> > Min Q1 Med Q3 Max
> > -3.98674 -0.5338083 -0.02783649 0.5261591 4.750609
> > Number of Observations: 2952
> > Number of Groups: 403
> > >
> >
> > Why are the DF of Linf and K different? I would apreciate if you could point me to a reference
>
> The algorithm is described in Pinheiro and Bates (2000) "Mixed-effects
> Models in S and S-PLUS" published by Springer. See section 2.4.2
>
> I would point out that there is effectively no difference between a
> t-distribution with 402 df and a t-distribution with 2549 df so the
> actual number of degrees of freedom is irrelevant in this case. All
> you need to know is that it is "large".
>
> I will defer to any of the "degrees of freedom police" who post to
> this list to give you an explanation of why there should be different
> degrees of freedom. I have been studying mixed-effects models for
> nearly 15 years and I still don't understand.
>
> > Note: I working with Splus 6.1. for Windows
>
> Technically this email list is for questions about R. There is
> another list, s-news at biostat.wustl.edu, for questions about S-PLUS.
>
> >
> >
> > Lic. Gabriela Escati Peñaloza
> > Biología y Manejo de Recursos Acuáticos
> > Centro Nacional Patagónico(CENPAT).
> > CONICET
> > Bvd. Brown s/nº.
> > (U9120ACV)Pto. Madryn
> > Chubut
> > Argentina
> >
> > Tel: 54-2965/451301/451024/451375/45401 (Int:277)
> > Fax: 54-29657451543
> >
> > ---------------------------------
> > 1GB gratis, Antivirus y Antispam
> > Correo Yahoo!, el mejor correo web del mundo
> > Abrí tu cuenta aquí
> > [[alternative HTML version deleted]]
> >
> >
> >
> > ______________________________________________
> > R-help at stat.math.ethz.ch mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
> >
> >
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>
>
>
>
More information about the R-help
mailing list