| step.spind {spind} | R Documentation |
Stepwise model selection for GEEs and WRMs
Description
Stepwise model selection by AIC or AICc for WRMS and QIC for GEEs
Usage
step.spind(object, data, steps = NULL, trace = TRUE, AICc = FALSE)
Arguments
object |
A model of class |
data |
The data used to fit that model. |
steps |
Number of iterations the procedure should go through before concluding. The default is to use the number of variables as the number of iterations. |
trace |
Should R print progress updates and the final, best model found
to the console? Default is |
AICc |
Logical. In the case of model selection with |
Details
This function performs stepwise variable elimination for model comparison. Each iteration will try to find the best combination of predictors for a given number of variables based on AIC, AICc, or QIC, and then use that as the base model for the next iteration until there are no more variables to eliminate. Alternatively, it will terminate when reducing the number of variables while respecting the model hierarchy no longer produces lower information criterion values.
Value
A list with components model and table.
model is always formula for the best model found by the procedure.
table is always a data frame, but the content varies for each type of
model.
For WRM's, the columns
returned are
Deleted.VarsVariables retained from the previous iteration which were tested in the current iteration.LogLikLog-likelihood of the model.AICAIC score for the model.AICcAICc score for the model.
For GEEs:
Deleted.VarsVariables retained from the previous iteration which were tested in the current iteration.QICQuasi-information criterion of the model.Quasi.LikQuasi-likelihood of the model.
Note
Currently, the function only supports backwards model selection (i.e. one must start with a full model and subtract variables). Forward and both directions options may be added later.
Author(s)
Sam Levin
References
Hardin, J.W. & Hilbe, J.M. (2003) Generalized Estimating Equations. Chapman and Hall, New York.
See Also
qic.calc, aic.calc, add1,
step, stepAIC
Examples
# For demonstration only. We are artificially imposing a grid structure
# on data that is not actually spatial data
library(MASS)
data(birthwt)
x <- rep(1:14, 14)
y <- as.integer(gl(14, 14))
coords <- cbind(x[-(190:196)], y[-(190:196)])
## Not run:
formula <- formula(low ~ age + lwt + race + smoke + ftv + bwt)
mgee <- GEE(formula,
family = "gaussian",
data = birthwt,
coord = coords,
corstr = "fixed",
scale.fix = TRUE)
ss <- step.spind(mgee, birthwt)
best.mgee <- GEE(ss$model,
family = "gaussian",
data = birthwt,
coord = coords,
corstr = "fixed",
scale.fix = TRUE)
summary(best.mgee, printAutoCorPars = FALSE)
## End(Not run)