# NOT RUN {
data(ohio)
fm1 <- geeglm(resp ~ age * smoke, id = id, data = ohio,
family = binomial, corstr = "exchangeable", scale.fix = TRUE)
fm2 <- update(fm1, corstr = "ar1")
fm3 <- update(fm1, corstr = "unstructured")
# QIC function is also defined in 'geepack' but is returns a vector[6], so
# cannot be used as 'rank'. Either use `MuMIn::QIC` syntax or make a wrapper
# around `geepack::QIC`
QIC <- MuMIn::QIC
# }
# NOT RUN {
QIC <- function(x) geepack::QIC(x)[1]
# }
# NOT RUN {
model.sel(fm1, fm2, fm3, rank = QIC)
# }
# NOT RUN {
# same result:
dredge(fm1, m.lim = c(3, NA), rank = QIC, varying = list(
corstr = list("exchangeable", "unstructured", "ar1")
))
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab