我正在尝试从一个MuMIn::dredge
对象中对多个泊松模型的系数和标准误差求幂以与texreg::screenreg
. 对于一个模型,我们可以这样做:
library(MuMIn)
library(texreg)
data(Cement)
m1 <- glm(X1 ~ y, data = Cement, na.action = "na.fail", family = poisson())
screenreg(m1)
# ==========================
# Model 1
# --------------------------
# (Intercept) -2.39 **
# (0.88)
# y 0.04 ***
# (0.01)
# --------------------------
# AIC 76.03
# BIC 77.16
# Log Likelihood -36.02
# Deviance 26.76
# Num. obs. 13
# ==========================
# *** p < 0.001, ** p < 0.01, * p < 0.05
#EXP VERSION:
tr <- texreg::extract(m1)
screenreg(m1, override.coef = exp(tr@coef), override.se = exp(tr@se))
# ==========================
# Model 1
# --------------------------
# (Intercept) 0.09 **
# (2.41)
# y 1.05 ***
# (1.01)
# --------------------------
# AIC 76.03
# BIC 77.16
# Log Likelihood -36.02
# Deviance 26.76
# Num. obs. 13
# ==========================
# *** p < 0.001, ** p < 0.01, * p < 0.05
# Warning message:
# In override(models, override.coef, override.se, override.pvalues, :
# Standard errors were provided using 'override.se', but p-values were not replaced!
现在,如果我们dredge
用来查看所有组合并获得没有指数值的输出:
fm1 <- glm(X1 ~ ., data = Cement, na.action = "na.fail", family = poisson())
dd <- dredge(fm1)
#shorten output
dd <- dd[1:4, ]
screenreg(dd)
# =============================================================
# Model 1 Model 2 Model 3 Model 4
# -------------------------------------------------------------
# (Intercept) 0.98 3.95 *** 7.74 ** 3.45 ***
# (1.02) (0.33) (2.07) (0.23)
# X3 -0.12 ** -0.16 *** -0.15 *** -0.15 ***
# (0.03) (0.03) (0.03) (0.03)
# y 0.02 *
# (0.01)
# X4 -0.02 -0.06 *
# (0.01) (0.03)
# X2 -0.05
# (0.03)
# -------------------------------------------------------------
# Log Likelihood -24.98 -25.95 -24.22 -28.48
# AICc 58.62 60.56 61.44 62.16
# Delta 0.00 1.94 2.82 3.55
# Weight 0.56 0.21 0.14 0.09
# Num. obs. 13 13 13 13
# =============================================================
# *** p < 0.001, ** p < 0.01, * p < 0.05
现在我不知道如何获得dd
对象的所有指数值,这就是我的想法:
tr <- texreg::extract(dd)
screenreg(dd, override.coef = exp(tr@coef), override.se = exp(tr@se))
这行不通,我猜有一个快速的解决方法?
谢谢