step.spind: Stepwise model selection for GEEs and WRMs

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

Description

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

Usage

1
step.spind(object, data, steps = NULL, trace = TRUE, AICc = FALSE)

Arguments

object

A model of class WRM or GEE.

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 TRUE.

AICc

Logical. In the case of model selection with WRMs, should AICc be used to determine which model is best rather than AIC? This argument is ignored for GEEs. Default is FALSE.

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

For GEEs:

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

 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)

spind documentation built on Jan. 13, 2021, 6:04 p.m.