Reputation: 11
I am trying to run a dredge on my full model clogit
(from package survival
) but R keeps crashing every time I attempt it. I just get an error message saying, "R encountered a fatal error. The session was terminated."
library(survival)
FullModel <- clogit(OBSERVED ~ Canopy + distgr_sca + Near_Hwy3 + strata(PID1), Compiled)
library(MuMIn)
dredge(FullModel)
This is my code. Any ideas on why this is crashing, or other ways I can go about running a full dredge on my model?
Thank you.
Upvotes: 0
Views: 580
Reputation: 1562
clogit
seems to crash R when no strata is specified in the model formula or when strata()
is the only model term. You need to tell dredge
to keep strata(PID1)
in all models and restrict the subsets to have minimum 3 variables:
dredge(fm0, eval = T, fixed = "strata(id)", m.min = 3)
reproducible example:
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)
Upvotes: 1