我以前从未在疏浚中使用过这个功能(知道它的存在真是太好了)。我认为您的问题在于scale()
公式中函数的使用。我认为这真的没有必要。您的模型的系数当然会受到解释变量幅度的影响,但这对它们是否被确定为有助于解释响应变量没有任何影响。如果可能的话,我建议删除这些,然后您的魔杖似乎可以使用的过程dredge()
:
library("MuMIn")
n <- 100
set.seed(1)
df <- data.frame(R1 = rnorm(n), X1 = rnorm(n), X2 = rnorm(n), X3 = rnorm(n))
fmla <- formula(R1 ~ (X1 + X2 + X3)^2)
M1 <- glm(formula = fmla, data = df)
summary(M1)
options(na.action = "na.fail")
M2 <- dredge(global.model = M1, subset = (X2 |!X1:X2) & (X3 |! X1:X3), rank = AIC)
options(na.action = "na.omit")
M2
# Global model call: glm(formula = fmla, data = df)
# ---
# Model selection table
# (Int) X1 X2 X3 X1:X2 X1:X3 X2:X3 df logLik AIC delta weight
# 1 0.10890 2 -130.655 265.3 0.00 0.253
# 56 0.11640 0.068320 0.03391 -0.04753 -0.2215 -0.1414 7 -126.119 266.2 0.93 0.159
# 5 0.11120 -0.04568 3 -130.528 267.1 1.75 0.106
# 3 0.10840 0.01596 3 -130.638 267.3 1.97 0.095
# 24 0.10090 0.056060 0.03889 -0.06773 -0.2180 6 -127.758 267.5 2.21 0.084
# 64 0.11350 0.077270 0.03040 -0.04011 -0.07512 -0.2003 -0.1377 8 -125.846 267.7 2.38 0.077
# 39 0.12550 0.01554 -0.02882 -0.1369 5 -129.039 268.1 2.77 0.063
# 32 0.09808 0.066770 0.03469 -0.05856 -0.08673 -0.1937 7 -127.404 268.8 3.50 0.044
# 7 0.11070 0.02107 -0.04812 4 -130.498 269.0 3.69 0.040
# 40 0.12590 0.008263 0.01585 -0.02832 -0.1374 6 -129.035 270.1 4.76 0.023
# 48 0.11880 0.035720 0.01253 -0.01789 -0.14030 -0.1312 7 -128.040 270.1 4.77 0.023
# 16 0.10380 0.027010 0.01719 -0.03621 -0.14930 6 -129.399 270.8 5.49 0.016
# 8 0.11070 -0.002730 0.02096 -0.04826 5 -130.498 271.0 5.69 0.015
# Models ranked by AIC(x)
您的公式中实际上并没有三向交互(其中将包括 ( X1:X2:X3
,并且将包含在公式R1 ~ (X1 + X2 + X3)^3
.
最后,如果使用 对scale
您很重要,并且您没有计算时间问题,您可以随时按照子集标准过滤生成的 M2 表。