对gee包中的plot_models使用健壮的SE

时间:2019-12-19 15:00:42

标签: r robust sjplot gee

我注意到使用sjPlot包中的plot_models会基于朴素标准错误给出置信区间。我希望它使用功能强大的SE。有简单的解决方法吗?

1 个答案:

答案 0 :(得分:1)

当前,sjPlot不支持此选项,但是计划进行即将进行的更新。 sjPlot 使用parameters package计算模型参数-如果您不介意从GitHub更新 parameters 包(并安装see package),您已经可以使用此功能:

library(parameters)
library(gee)

data(warpbreaks)
model <- gee(breaks ~ tension, id = wool, data = warpbreaks)
#> Beginning Cgee S-function, @(#) geeformula.q 4.13 98/01/27
#> running glm to get initial regression estimate
#> (Intercept)    tensionM    tensionH 
#>    36.38889   -10.00000   -14.72222

mp <- model_parameters(model)

mp
#> Parameter   | Coefficient |   SE |          95% CI |     z | df |      p
#> ------------------------------------------------------------------------
#> (Intercept) |       36.39 | 2.80 | [ 30.90, 41.88] | 12.99 | 51 | < .001
#> tension [M] |      -10.00 | 3.96 | [-17.76, -2.24] | -2.53 | 51 | 0.015 
#> tension [H] |      -14.72 | 3.96 | [-22.48, -6.96] | -3.72 | 51 | < .001

plot(mp)

mp <- model_parameters(model, robust = TRUE)

mp
#> Parameter   | Coefficient |   SE |          95% CI |     z | df |      p
#> ------------------------------------------------------------------------
#> (Intercept) |       36.39 | 5.77 | [ 25.07, 47.71] |  6.30 | 51 | < .001
#> tension [M] |      -10.00 | 7.46 | [-24.63,  4.63] | -3.94 | 51 | 0.186 
#> tension [H] |      -14.72 | 3.73 | [-22.04, -7.41] | -1.34 | 51 | < .001

plot(mp)

reprex package(v0.3.0)于2019-12-23创建