[R-sig-ME] how to get satterthwaite/Kenward-Roger degrees of freedom for heterogeneous-variance one-way ANOVA from an object of nlme::gls
Qiu, Weiliang /US
We|||@ng@Q|u @end|ng |rom @@no||@com
Fri Oct 18 13:58:53 CEST 2024
Dear Prof. Lenth,
Thank you for the clarifications, which is very helpful!
Best regards,
Weiliang
From: R-sig-mixed-models <r-sig-mixed-models-bounces using r-project.org> On Behalf Of Lenth, Russell V via R-sig-mixed-models
Sent: Thursday, October 17, 2024 9:06 PM
To: r-sig-mixed-models using r-project.org
Subject: Re: [R-sig-ME] how to get satterthwaite/Kenward-Roger degrees of freedom for heterogeneous-variance one-way ANOVA from an object of nlme::gls
A couple of clarifications on what emmeans does and does not do. The main thing to know is it is only capable of obtaining Satterthwaite degrees of freedom for _one linear function at a time_. For the denominator d.f. of joint.tests() (labeled df2 in tables), we obtain the d.f. for each contrast involved, and what is shown as df2 is the minimum of these. This is usually conservative, but I can't say it always is. I'm realizing I need to document this.
emmeans supports Satterthwaite d.f. for gls objects, but not lme. That is because we cannot access the needed internal functions. I put in a request to the nlme maintainers for more support years ago, but it met with deaf ears.
For a given variance estimate V, the Satterthwaite d.f. is equal to 2V^2/var(V), so we need to be able to get var(V) as a function of the fixed-effect parameters. For lme models, I do provide an "appx-Satterthwaite" method that involves perturbing the response values slightly, then estimating var(V) empirically. It works surprisingly well, especially given that only a few perturbations are used.
As I understand it, K-R d.f. are done in the same manner except that they are based on a bias-adjusted covariance matrix that I don't think is available in the nlme package.
--
Russell V. Lenth - Professor Emeritus
Department of Statistics and Actuarial Science
The University of Iowa - Iowa City, IA 52242 USA
Dept office (319)335-0712 - FAX (319)335-3017
russell-lenth using uiowa.edu<mailto:russell-lenth using uiowa.edu> - http://www.stat.uiowa.edu/~rlenth/<http://www.stat.uiowa.edu/~rlenth>
-----Original Message-----
Date: Thu, 17 Oct 2024 09:17:33 +0200
From: Maarten Jung <jungmaarten using gmail.com<mailto:jungmaarten using gmail.com>>
To: r-sig-mixed-models using r-project.org<mailto:r-sig-mixed-models using r-project.org>
Subject: Re: [R-sig-ME] how to get satterthwaite/Kenward-Roger degrees
of freedom for heterogeneous-variance one-way ANOVA from an object of
nlme::gls
Message-ID: <8579173f-fa46-4351-8770-cb2319b44ed4 using gmail.com<mailto:8579173f-fa46-4351-8770-cb2319b44ed4 using gmail.com>>
Content-Type: text/plain; charset="utf-8"; Format="flowed"
The emmeans::joint_tests function can give you type III style tests.
library(nlme)
library(emmeans)
d <- ToothGrowth
d$dose <- as.factor(d$dose)
res.gls <- gls(len ~ supp * dose, data = d, weights = varIdent(form = ~
1 | supp * dose))
anova(res.gls, type = "marginal")
joint_tests(res.gls, mode = "satterthwaite") joint_tests(res.gls, mode = "df.error") joint_tests(res.gls, mode = "asymptotic")
Best,
Maarten
_______________________________________________
R-sig-mixed-models using r-project.org<mailto:R-sig-mixed-models using r-project.org> mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models<https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models>
[[alternative HTML version deleted]]
More information about the R-sig-mixed-models
mailing list