0
$\begingroup$

I have some strangeness going on when calculating CIs for my model. I've found 2 ways to do this, and I decided to try them both (emmeans and confint).

I have 6 timepoint and 2 groups. My model looks something like this:

model<-lmer("responseVAR~factor(timepoint)*factor(group) + (timepoint|subject) + sex", data)

This is what I get with emmeans:

emmeans(model, "timepoint", "group")

group = 1:
 timepoint emmean    SE    df lower.CL upper.CL
        1   8.38 0.486 110.8     7.42     9.34
        2   6.91 0.536 154.8     5.85     7.97
        3   5.75 0.581 163.8     4.60     6.90
        4   5.21 0.656 156.5     3.92     6.51
        5   4.74 0.692 113.4     3.37     6.11
        6   5.16 0.966 111.4     3.24     7.07

group = 2:
 timepoint emmean    SE    df lower.CL upper.CL
        1   8.28 0.692 106.5     6.91     9.66
        2   7.85 0.799 168.8     6.27     9.42
        3   7.08 0.832 167.9     5.44     8.72
        4   6.84 0.921 159.0     5.02     8.66
        5   6.84 0.887  92.5     5.08     8.60
        6   4.14 1.219 111.2     1.72     6.56

And this is what I get with confint

confint(model)
                                       2.5 %     97.5 %
.sig01                             0.99893416  2.9788424
.sig02                            -0.81362432  1.0000000
.sig03                             0.03442704  0.7801731
.sigma                             2.01005448  2.570744
(Intercept)                        4.77889981  8.6825788
factor(timepoint)2                -2.48547074 -0.4602945
factor(timepoint)3                -3.72496655 -1.5462229
factor(timepoint)4                -4.40019534 -1.9419390
factor(timepoint)5                -4.92791619 -2.3636326
factor(timepoint)6                -5.02534365 -1.3708410
factor(group)2                    -1.60598418  1.4010876
Sex                               -0.35709146  2.5673636
factor(timepoint)2:factor(group)2 -0.78898029  2.8635743
factor(timepoint)3:factor(group)2 -0.47127777  3.3355089
factor(timepoint)4:factor(group)2 -0.38316365  3.8446059
factor(timepoint)5:factor(group)2  0.11266374  4.3063505
factor(timepoint)6:factor(group)2 -3.91956691  1.9927936

Also, adding covariates (e.g. Sex) seems to affect a lot the results of the confint method because lower and upper confidence levels get very far apart. emmeans results seem to not vary that much.

What method should I trust more? I would have used emmeans, but I didn't find how to calculate CIs for the covariates.

How can I calculate CIs for covariates with emmeans?

$\endgroup$
3
$\begingroup$

You are comparing apples and oranges. The emmeans() results are predictions from the model, or averages thereof. The confint() results are estimates of the fixed-effect regression coefficients.

In notational terms, you have a model that says something like

$$ y = \beta_0 + \beta_1 x_1 + \beta_2 x_2 + \ldots + e $$

Your model is a lot more sophisticated than this, but this is the basic idea. The emmeans() results are estimates of predictions for $y$ at various combinations of the $x_j$, and the confint() results are estimates of $\beta_0, \beta_1, \beta_2, \ldots$.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.