用于提取 lme4 包中固定效应标准错误的 R 代码

R code for pulling out fixed effect standard errors in lme4 package

我想提取使用 lmer() 完成的回归的标准误差。例如,

library(lme4)
data(iris)
head(iris)
model <- lmer(Sepal.Length ~ Sepal.Width + (1 | Species), data=iris);       
summary(model)

看总结的固定效应,可以看到标准误。

Fixed effects:
            Estimate Std. Error t value
(Intercept)   3.4062     0.6683   5.097
Sepal.Width   0.7972     0.1062   7.506

我想将其提取出来,而不必手动输入。

summary(model)$coef[, 2, drop = FALSE]

或者

sqrt(diag(vcov(model)))