同一模型 lmer modelsummary sjPlot 的不同输出

问题描述 投票:0回答:1

我遇到了一个我无法解决的小问题。

我开发了一个模型,并使用

lmer
进行测试。完整代码:

#importing library
library(tidyverse)
library(lmerTest)
library(car)
library(easystats)
library(modelsummary)
library(lme4)

df <- Mod_Final_R1R2_Meta_moderation_sharing
summary(df)

df_x <- subset(df, Category == "x")

modelZ <- lmer(reliability corrected ~ 0 + intention + a + b + (1|Study), data = df_x).

summary(modelZ)
modelsummary(modelZ, statistic="p.value")

我通过以下方式收到(部分)以下输出:

summary(modelZ)
Linear mixed model fit by REML. t-tests use Satterthwaite's method ['lmerModLmerTest']
Formula: `Y` ~ 0 + intention + a + b + c + (1 | Study)
   Data: df_x

REML criterion at convergence: 14.3

Scaled residuals: 
     Min       1Q   Median       3Q      Max 
-1.51502 -0.22449 -0.06608  0.36910  1.52729 

Random effects:
 Groups   Name        Variance Std.Dev.
 Study    (Intercept) 0.22052  0.4696  
 Residual             0.01198  0.1094  
Number of obs: 25, groups:  Study, 15

Fixed effects:
                   Estimate Std. Error       df t value Pr(>|t|)
intention          -0.10750    0.05989  9.27089  -1.795    0.105
a                   0.02907    0.22882 11.72994   0.127    0.901
b                   0.12935    0.26092 11.69105   0.496    0.629
c                  -0.17325    0.22935 12.19998  -0.755    0.464

但是,如果我通过包

modelsummary
sjPlot
提取模型摘要(两个包的输出相同),我会收到以下输出:

modelsummary(modelZ, statistic="p.value")
变量 估计 p 值
意图 -0.107 0.089
a 0.029 0.900
b 0.129 0.626
c -0.173 0.459

正如您所看到的,虽然估计值或多或少相同,但 p 值却截然不同,有些甚至处于不显着到显着的阈值。有谁知道造成这种情况的潜在机制是什么?难道不应该提取并使用 lmer 的 modelx 输出吗?

提前致谢!

我在 Stackoverflow 和 CRAN 包等论坛上搜索了任何根本原因,但没有找到。

r lme4 summary sjplot modelsummary
1个回答
0
投票

在没有可重现的例子的情况下,我最好的猜测是这来自用于有限尺寸校正的方法。

modelsummary()
调用
parameters::model_parameters()
提取参数;混合模型的
ci_method
选项为“wald”(无有限尺寸校正)、“satterthwaite”或“kenward”。我相信
ci_method=
论点将从
modelsummary()
传递到
model_parameters()
:你可以尝试
ci_method = "satterthwaite"
看看会发生什么......

library(modelsummary)
library(parameters)
library(lmerTest)
set.seed(101)
dd <- data.frame(f = factor(rep(1:8, each = 10)), x  = rnorm(80))
dd$y <- simulate(~ x + (1|f), newdata = dd,
   family = gaussian,
   newparams = list(beta = c(0, 0.5), theta = 1, sigma = 0.5),
   seed = 101)[[1]]
m1 <- lmer(y ~ x + (1|f), data = dd)
model_parameters(m1, effects = "fixed")
# Fixed Effects

Parameter   | Coefficient |   SE |        95% CI | t(76) |      p
-----------------------------------------------------------------
(Intercept) |        0.05 | 0.09 | [-0.12, 0.23] |  0.61 | 0.541 
x           |        0.45 | 0.06 | [ 0.33, 0.58] |  7.36 | < .001

Uncertainty intervals (equal-tailed) and p-values (two-tailed) computed
  using a Wald t-distribution approximation.
> model_parameters(m1, effects = "fixed", ci_method = "satterthwaite")
# Fixed Effects

Parameter   | Coefficient |   SE |        95% CI |    t |    df |      p
------------------------------------------------------------------------
(Intercept) |        0.05 | 0.09 | [-0.16, 0.26] | 0.61 |  7.05 | 0.559 
x           |        0.45 | 0.06 | [ 0.33, 0.58] | 7.36 | 74.05 | < .001

Uncertainty intervals (equal-tailed) and p-values (two-tailed) computed
  using a Wald t-distribution with Satterthwaite approximation.
> model_parameters(m1, effects = "fixed", ci_method = "kenward")
# Fixed Effects

Parameter   | Coefficient |   SE |        95% CI |    t |    df |      p
------------------------------------------------------------------------
(Intercept) |        0.05 | 0.09 | [-0.16, 0.26] | 0.61 |  7.02 | 0.559 
x           |        0.45 | 0.06 | [ 0.33, 0.58] | 7.31 | 74.04 | < .001

Uncertainty intervals (equal-tailed) and p-values (two-tailed) computed
  using a Wald t-distribution with Kenward-Roger approximation.
© www.soinside.com 2019 - 2024. All rights reserved.