# NOT RUN {
# 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)
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab