[R-sig-ME] [External] Re: Help with interpreting one fixed-effect coefficient
Lenth, Russell V
ru@@e||-|enth @end|ng |rom u|ow@@edu
Mon Sep 27 02:42:31 CEST 2021
I guess correctness is in the eyes of the beholder. But I think this illustrates the folly of the additive model. Having additive effects suggests a belief that you can vary one factor more or less independently of the other. In his comments, John Fox makes a good point that escaped my earlier cursory view of the original question, that you don't have data on girls attending all-boys' schools, nor boys attending all-girls' schools; yet the model that was fitted estimates a mean response for both those situations. That's a pretty clear testament to the failure of that model – and also why the coefficients don't make sense. And finally why we have estimates of 15 comparisons (some of which are aliased with one another), when only 6 of them make sense.
If instead, a model with interaction were fitted, it would be a rank-deficient model because two cells are empty. Perhaps there is some sort of nesting structure that could be used to work around that. However, it doesn't matter much because emmeans assesses estimability, and the two combinations I mentioned above would be flagged as non-estimable. One could then more judiciously use the contrast function to test meaningful contrasts across this irregular array of cell means. Or even injudiciously asking for all pairwise comparisons, you will see 6 estimable ones and 9 non-estimable ones. See output below.
Russ
----- Interactive model -----
> Form <- normexam ~ 1 + standlrt + schgend * sex + (standlrt | school)
> model <- lmer(Form, data = tutorial, REML = FALSE)
fixed-effect model matrix is rank deficient so dropping 2 columns / coefficients
>
> emmeans(model, pairwise~schgend+sex)
... messages deleted ...
$emmeans
schgend sex emmean SE df asymp.LCL asymp.UCL
mixedsch boy -0.18781 0.0514 Inf -0.2885 -0.0871
boysch boy -0.00795 0.0880 Inf -0.1805 0.1646
girlsch boy nonEst NA NA NA NA
mixedsch girl -0.01955 0.0521 Inf -0.1216 0.0825
boysch girl nonEst NA NA NA NA
girlsch girl 0.15527 0.0632 Inf 0.0313 0.2792
Degrees-of-freedom method: asymptotic
Confidence level used: 0.95
$contrasts
contrast estimate SE df z.ratio p.value
mixedsch boy - boysch boy -0.1799 0.0991 Inf -1.814 0.4565
mixedsch boy - girlsch boy nonEst NA NA NA NA
mixedsch boy - mixedsch girl -0.1683 0.0338 Inf -4.975 <.0001
mixedsch boy - boysch girl nonEst NA NA NA NA
mixedsch boy - girlsch girl -0.3431 0.0780 Inf -4.396 0.0002
boysch boy - girlsch boy nonEst NA NA NA NA
boysch boy - mixedsch girl 0.0116 0.0997 Inf 0.116 1.0000
boysch boy - boysch girl nonEst NA NA NA NA
boysch boy - girlsch girl -0.1632 0.1058 Inf -1.543 0.6361
girlsch boy - mixedsch girl nonEst NA NA NA NA
girlsch boy - boysch girl nonEst NA NA NA NA
girlsch boy - girlsch girl nonEst NA NA NA NA
mixedsch girl - boysch girl nonEst NA NA NA NA
mixedsch girl - girlsch girl -0.1748 0.0788 Inf -2.219 0.2287
boysch girl - girlsch girl nonEst NA NA NA NA
Degrees-of-freedom method: asymptotic
P value adjustment: tukey method for comparing a family of 6 estimates
---------------------------------------------------------
From: Simon Harmel <sim.harmel using gmail.com>
Sent: Sunday, September 26, 2021 3:08 PM
To: Lenth, Russell V <russell-lenth using uiowa.edu>
Cc: r-sig-mixed-models using r-project.org
Subject: [External] Re: [R-sig-ME] Help with interpreting one fixed-effect coefficient
Dear Russ and the List Members,
If we use Russ' great package (emmeans), we see that although meaningless, but "schgendgirl-only" can be interpreted using the logic I mentioned here: https://stat.ethz.ch/pipermail/r-sig-mixed-models/2021q3/029723.html .
That is, "schgendgirl-only" can meaninglessly mean: ***diff. bet. boys in girl-only vs. mixed schools*** just like it can meaningfully mean: ***diff. bet. girls in girl-only vs. mixed schools***
Russ, have I used emmeans correctly?
Simon
Here is a reproducible code:
library(R2MLwiN) # For the dataset
library(lme4)
library(emmeans)
data("tutorial")
Form <- normexam ~ 1 + standlrt + schgend + sex + (standlrt | school)
model <- lmer(Form, data = tutorial, REML = FALSE)
emmeans(model, pairwise~schgend+sex)$contrast
contrast estimate SE df z.ratio p.value
mixedsch boy - boysch boy -0.17986 0.0991 Inf -1.814 0.4565
mixedsch boy - girlsch boy -0.17482 0.0788 Inf -2.219 0.2287 <--This coef. equals
mixedsch boy - mixedsch girl -0.16826 0.0338 Inf -4.975 <.0001
mixedsch boy - boysch girl -0.34813 0.1096 Inf -3.178 0.0186
mixedsch boy - girlsch girl -0.34308 0.0780 Inf -4.396 0.0002
boysch boy - girlsch boy 0.00505 0.1110 Inf 0.045 1.0000
boysch boy - mixedsch girl 0.01160 0.0997 Inf 0.116 1.0000
boysch boy - boysch girl -0.16826 0.0338 Inf -4.975 <.0001
boysch boy - girlsch girl -0.16322 0.1058 Inf -1.543 0.6361
girlsch boy - mixedsch girl 0.00656 0.0928 Inf 0.071 1.0000
girlsch boy - boysch girl -0.17331 0.1255 Inf -1.381 0.7388
girlsch boy - girlsch girl -0.16826 0.0338 Inf -4.975 <.0001
mixedsch girl - boysch girl -0.17986 0.0991 Inf -1.814 0.4565
mixedsch girl - girlsch girl -0.17482 0.0788 Inf -2.219 0.2287 <--This coef.
boysch girl - girlsch girl 0.00505 0.1110 Inf 0.045 1.0000
More information about the R-sig-mixed-models
mailing list