John Sorkin
2015-Jul-07 15:40 UTC
[R] degrees of freedom (and hence p values) from lme and lmer don't agree . . . Why?????????
I am trying to fit data from 23 subjects using random effects regression, and am comparing the results of lme and lmer. The point estimates and the SEs are the same in both models, however the degrees of freedom are widely different. lme reports 88 DF, lmer approximately 22. Can someone help me understand why the DFs are not the same? I have 23 subjects, each of whom is studied in up to five different experimental conditions (i.e. Amp). For each condition multiple measurements are made for each subject (i.e. X). Thank you, John # lme: Random intercept, random slope. cat("********This analysis has 88 degrees of freedom\n") fit0X.new <- groupedData(X~Amp|SS,data=data,order.groups=FALSE) xx <- lme(fit0X.new,random=~1+Amp) summary(xx) cat("\n\n") # lmer: Random intercept, random slope. cat("*********This analysis has ~22 degrees of freedom\n") fit0X <- lmer(X~Amp+(1+Amp|SS),data=data) print(summary(fit0X)) fit0XSum<-summary(fit0X)$coefficients ********This analysis has 88 degrees of freedom Linear mixed-effects model fit by REML Data: fit0X.new AIC BIC logLik 331.7688 347.9717 -159.8844 Random effects: Formula: ~1 + Amp | SS Structure: General positive-definite, Log-Cholesky parametrization StdDev Corr (Intercept) 1.3515911 (Intr) Amp 2.5619953 -0.366 Residual 0.6139429 Fixed effects: X ~ Amp Value Std.Error DF t-value p-value (Intercept) 1.718376 0.3609133 88 4.761188 0 Amp 6.890429 0.5978236 88 11.525856 0 Correlation: (Intr) Amp -0.526 Standardized Within-Group Residuals: Min Q1 Med Q3 Max -2.2177007 -0.5770388 -0.1249565 0.5247444 4.1150164 Number of Observations: 112 Number of Groups: 23 *********This analysis has ~22 degrees of freedom Linear mixed model fit by REML t-tests use Satterthwaite approximations to degrees of freedom [merModLmerTest] Formula: X ~ Amp + (1 + Amp | SS) Data: data REML criterion at convergence: 319.8 Scaled residuals: Min 1Q Median 3Q Max -2.2177 -0.5770 -0.1250 0.5247 4.1150 Random effects: Groups Name Variance Std.Dev. Corr SS (Intercept) 1.8268 1.3516 Amp 6.5638 2.5620 -0.37 Residual 0.3769 0.6139 Number of obs: 112, groups: SS, 23 Fixed effects: Estimate Std. Error df t value Pr(>|t|) (Intercept) 1.7184 0.3609 21.1150 4.761 0.000104 *** Amp 6.8904 0.5978 22.0460 11.526 8.37e-11 *** --- Signif. codes: 0 ?***? 0.001 ?**? 0.01 ?*? 0.05 ?.? 0.1 ? ? 1 Correlation of Fixed Effects: (Intr) Amp -0.526 John David Sorkin M.D., Ph.D. Professor of Medicine Chief, Biostatistics and Informatics University of Maryland School of Medicine Division of Gerontology and Geriatric Medicine Baltimore VA Medical Center 10 North Greene Street GRECC (BT/18/GR) Baltimore, MD 21201-1524 (Phone) 410-605-7119 (Fax) 410-605-7913 (Please call phone number above prior to faxing) Confidentiality Statement: This email message, including any attachments, is for the sole use of the intended recipient(s) and may contain confidential and privileged information. Any unauthorized use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message.
Bert Gunter
2015-Jul-07 15:57 UTC
[R] degrees of freedom (and hence p values) from lme and lmer don't agree . . . Why?????????
This is a **highly technical** statistical issue, not an R-Help topic. I strongly suggest that you post to the R-sig-mixed-models list instead. Cheers, Bert Bert Gunter "Data is not information. Information is not knowledge. And knowledge is certainly not wisdom." -- Clifford Stoll On Tue, Jul 7, 2015 at 8:40 AM, John Sorkin <JSorkin at grecc.umaryland.edu> wrote:> I am trying to fit data from 23 subjects using random effects > regression, and am comparing the results of lme and lmer. The point > estimates and the SEs are the same in both models, however the degrees > of freedom are widely different. lme reports 88 DF, lmer approximately > 22. Can someone help me understand why the DFs are not the same? I have > 23 subjects, each of whom is studied in up to five different > experimental conditions (i.e. Amp). For each condition multiple > measurements are made for each subject (i.e. X). > Thank you, > John > > > > # lme: Random intercept, random slope. > cat("********This analysis has 88 degrees of freedom\n") > fit0X.new <- groupedData(X~Amp|SS,data=data,order.groups=FALSE) > xx <- lme(fit0X.new,random=~1+Amp) > summary(xx) > cat("\n\n") > > > # lmer: Random intercept, random slope. > cat("*********This analysis has ~22 degrees of freedom\n") > fit0X <- lmer(X~Amp+(1+Amp|SS),data=data) > print(summary(fit0X)) > fit0XSum<-summary(fit0X)$coefficients > > > > ********This analysis has 88 degrees of freedom > Linear mixed-effects model fit by REML > Data: fit0X.new > AIC BIC logLik > 331.7688 347.9717 -159.8844 > Random effects: > Formula: ~1 + Amp | SS > Structure: General positive-definite, Log-Cholesky parametrization > StdDev Corr > (Intercept) 1.3515911 (Intr) > Amp 2.5619953 -0.366 > Residual 0.6139429 > Fixed effects: X ~ Amp > Value Std.Error DF t-value p-value > (Intercept) 1.718376 0.3609133 88 4.761188 0 > Amp 6.890429 0.5978236 88 11.525856 0 > Correlation: > (Intr) > Amp -0.526 > Standardized Within-Group Residuals: > Min Q1 Med Q3 Max > -2.2177007 -0.5770388 -0.1249565 0.5247444 4.1150164 > Number of Observations: 112 > Number of Groups: 23 > > *********This analysis has ~22 degrees of freedom > Linear mixed model fit by REML t-tests use Satterthwaite approximations > to degrees of freedom [merModLmerTest] > Formula: X ~ Amp + (1 + Amp | SS) > Data: data > REML criterion at convergence: 319.8 > Scaled residuals: > Min 1Q Median 3Q Max > -2.2177 -0.5770 -0.1250 0.5247 4.1150 > Random effects: > Groups Name Variance Std.Dev. Corr > SS (Intercept) 1.8268 1.3516 > Amp 6.5638 2.5620 -0.37 > Residual 0.3769 0.6139 > Number of obs: 112, groups: SS, 23 > Fixed effects: > Estimate Std. Error df t value Pr(>|t|) > (Intercept) 1.7184 0.3609 21.1150 4.761 0.000104 *** > Amp 6.8904 0.5978 22.0460 11.526 8.37e-11 *** > --- > Signif. codes: 0 ?***? 0.001 ?**? 0.01 ?*? 0.05 ?.? 0.1 ? ? 1 > Correlation of Fixed Effects: > (Intr) > Amp -0.526 > John David Sorkin M.D., Ph.D. > Professor of Medicine > Chief, Biostatistics and Informatics > University of Maryland School of Medicine Division of Gerontology and > Geriatric Medicine > Baltimore VA Medical Center > 10 North Greene Street > GRECC (BT/18/GR) > Baltimore, MD 21201-1524 > (Phone) 410-605-7119 > (Fax) 410-605-7913 (Please call phone number above prior to faxing) > > Confidentiality Statement: > This email message, including any attachments, is for ...{{dropped:12}}