Description Usage Arguments Details Value Note Author(s) References See Also Examples

Stepwise model selection by AIC or AICc for WRMS and QIC for GEEs

1 |

`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 |

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.

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.Vars`

Variables retained from the previous iteration which were tested in the current iteration.`LogLik`

Log-likelihood of the model.`AIC`

AIC score for the model.`AICc`

AICc score for the model.

For `GEE`

s:

`Deleted.Vars`

Variables retained from the previous iteration which were tested in the current iteration.`QIC`

Quasi-information criterion of the model.`Quasi.Lik`

Quasi-likelihood of the model.

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.

Sam Levin

Hardin, J.W. & Hilbe, J.M. (2003) Generalized Estimating Equations. Chapman and Hall, New York.

`qic.calc`

, `aic.calc`

, `add1`

,
`step`

, `stepAIC`

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | ```
# 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)
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.