尝试生成aictab
表格时收到错误消息
代码
library(MASS)
library(AICcmodavg)
set.seed(456)
d <- data.frame(ID = 1:20,
Ct = c(sample(x = 1:50, size = 12, replace = T), rep(x = 0, length.out = 8)),
V = as.factor(rep(x = c("Dry", "Wet"), each = 2)),
S = as.factor(rep(x = c("Sand", "Clay"), each = 2)))
m1 <- glm.nb(Ct ~ 1, data = d)
m2 <- glm.nb(Ct ~ V, data = d)
m3 <- glm.nb(Ct ~ S, data = d)
all_ms <- list(m1, m2, m3)
names(all_ms) <- c("null", "type", "soil")
aic_tb <- aictab(cand.set = all_ms, second.ord = TRUE)
输出
aictab.default 中的错误(cand.set = all_ms,second.ord = TRUE):尚未为此对象类定义函数
谁能明白为什么这会失败?