runehaubo / lmerTestR

Repository for the R-package lmerTest
48 stars 9 forks source link

Indentical p values from model summary and drop1 #33

Closed Benambridge closed 4 years ago

Benambridge commented 4 years ago

Hi

I'm running an lme4 mixed effects model with three continuous predictors and a continuous dependent variable, and using lmerTest to obtain p values (thanks so much for this functionality!)

I have tried obtaining p values using two different methods - taking them direct from the model summary table ("Pr(>|t|)" which I believe is calculated via the Satterthwaite approximation) and using drop1 ("Pr(>F)")which I believe compares models with and withou the predictor of interest using a likelihood ratio test.

What I don't understand is why these two methods - that seem in principle very different - yield identical p values (for two predictors absolutely identical - for the other, identical to like 6 decimal places). Is this just a quirk of my dataset (if so, what might be causing it), or is there a systematic reason why the two are mathematically equivalent in this type of scenario. Model output is pasted below.

Thanks! Ben

ENG_Adult_M= lmer(difference ~ PRE_FOR_LESS_TRANSPARENT + ENT_DIFF + EventMerge + (1|verb) + (1+PRE_FOR_LESS_TRANSPARENT+ENT_DIFF+EventMerge||participant), data=subset(ENG_Diff, Age_Group=="Adult"), control = lmerControl(optimizer = "bobyqa")) boundary (singular) fit: see ?isSingular summary(ENG_Adult_M, corr=F) Linear mixed model fit by REML. t-tests use Satterthwaite's method ['lmerModLmerTest'] Formula: difference ~ PRE_FOR_LESS_TRANSPARENT + ENT_DIFF + EventMerge + (1 | verb) + (1 + PRE_FOR_LESS_TRANSPARENT + ENT_DIFF + EventMerge ||
participant) Data: subset(ENG_Diff, Age_Group == "Adult") Control: lmerControl(optimizer = "bobyqa")

REML criterion at convergence: 4377.7

Scaled residuals: Min 1Q Median 3Q Max -4.7464 -0.5784 0.0349 0.5914 3.6363

Random effects: Groups Name Variance Std.Dev. verb (Intercept) 1.25176 1.1188
participant (Intercept) 0.04228 0.2056
participant.1 PRE_FOR_LESS_TRANSPARENT 0.04543 0.2132
participant.2 ENT_DIFF 0.00000 0.0000
participant.3 EventMerge 0.10685 0.3269
Residual 0.96267 0.9812
Number of obs: 1440, groups: verb, 60; participant, 48

Fixed effects: Estimate Std. Error df t value Pr(>|t|)
(Intercept) 0.3820 0.1497 60.1547 2.551 0.0133 *
PRE_FOR_LESS_TRANSPARENT 0.6427 0.5056 56.4418 1.271 0.2088
ENT_DIFF 0.5963 0.5088 55.9922 1.172 0.2462
EventMerge 1.2010 0.2058 61.9001 5.837 **2.11e-07 *****

Signif. codes: 0 ‘’ 0.001 ‘’ 0.01 ‘’ 0.05 ‘.’ 0.1 ‘ ’ 1 convergence code: 0 boundary (singular) fit: see ?isSingular

drop1(ENG_Adult_M) Single term deletions using Satterthwaite's method:

Model: difference ~ PRE_FOR_LESS_TRANSPARENT + ENT_DIFF + EventMerge + (1 | verb) + ((1 | participant) + (0 + PRE_FOR_LESS_TRANSPARENT | participant) + (0 + ENT_DIFF | participant) + (0 + EventMerge | participant)) Sum Sq Mean Sq NumDF DenDF F value Pr(>F)
PRE_FOR_LESS_TRANSPARENT 1.556 1.556 1 56.442 1.6161 0.2088
ENT_DIFF 1.322 1.322 1 55.992 1.3736 0.2462
EventMerge 32.793 32.793 1 61.900 34.0649 **2.109e-07 *****

Signif. codes: 0 ‘’ 0.001 ‘’ 0.01 ‘’ 0.05 ‘.’ 0.1 ‘ ’ 1

runehaubo commented 4 years ago

Since your model has class "lmerModLmerTest" calling drop1() gives you lmerTest::drop1 rather than lme4::drop1. The former produces F-tests based on Satterthwaites df (as the output indicates) while the latter produce the likelihood ratio tests you seem to expect (these are actually chi-square tests). And since one df F-tests are the same as t-tests, and since all terms are marginal to each other, the outputs from drop1 equals those from summary.

Cheers Rune

PS: to get the likelihood ratio chi-square tests I think you could use lme4::drop1(<my-model>), but the Satterthwaite F-test are in general more accurate.