# load sample data:
data(rotif.env)
names(rotif.env)
# build a stepwise model of a species' occurrence based on
# some of the variables:
mod <- with(rotif.env, step(glm(Abrigh ~ Area + Altitude + AltitudeRange +
HabitatDiversity + HumanPopulation, family = binomial)))
# examine the model:
summary(mod) # includes non-significant variables
# use modelTrim to get rid of those:
mod <- modelTrim(mod)
summary(mod) # only significant variables remain
Run the code above in your browser using DataLab