0

我正在尝试在我的完整模型clogit(来自 package survival)上运行挖泥机,但每次尝试时 R 都会崩溃。我只是收到一条错误消息,说“R 遇到致命错误。会话已终止。”

library(survival)
FullModel <- clogit(OBSERVED ~ Canopy + distgr_sca + Near_Hwy3 + strata(PID1), Compiled)
library(MuMIn)
dredge(FullModel)

这是我的代码。关于为什么会崩溃的任何想法,或者我可以在模型上运行完整挖泥机的其他方法?

谢谢你。

4

1 回答 1

1

clogit当模型公式中未指定层或何时strata()是唯一的模型项时,似乎会使 R 崩溃。您需要告诉dredge保留strata(PID1)所有模型并将子集限制为至少具有 3 个变量:

dredge(fm0, eval = T, fixed = "strata(id)", m.min = 3)

可重现的例子:

library(survival)
library(MuMIn)

## from example(clogit)
resp <- levels(logan$occupation)
n <- nrow(logan)
indx <- rep(1:n, length(resp))
logan2 <- data.frame(logan[indx,], id = indx, tocc = factor(rep(resp, each=n)))
logan2$case <- (logan2$occupation == logan2$tocc)
fm <- clogit(case ~ tocc + tocc:education + strata(id), logan2, na.action = "na.fail")
##

dredge(fm, fixed = "strata(id)", m.min = 3)
于 2014-04-04T10:00:57.410 回答