MuMIn::dredge
で使用するオブジェクトの複数のポアソン モデルの係数と標準誤差を累乗しようとしていますtexreg::screenreg
。1 つのモデルの場合、これを行うことができます。
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))
これは機能しません。簡単な回避策があると思いますか?
ありがとう