
cca
, rda
, capscale
).
The function ordistep
is modelled after step
and
can do forward, backward and stepwise model selection using permutation tests.
Function ordiR2step
performs forward model choice solely on adjusted
$R^2$ and P-value, for ordination objects created by rda
or capscale
.ordistep(object, scope, direction = c("both", "backward", "forward"),
Pin = 0.05, Pout = 0.1, pstep = 100, perm.max = 1000, steps = 50,
trace = TRUE, ...)
ordiR2step(object, scope, direction = c("both", "forward"),
Pin = 0.05, pstep = 100, perm.max = 1000,
trace = TRUE, ...)
upper
and lower
, both formulae.
See step
f"both"
,
"backward"
, or "forward"
, with a default of "both"
.
If the scope
argument is missing, the default for direction
is Pin
) a term to
the model, or dropping (Pout
) from the model. Term is added if
$P \le$ Pin
, and removed if $P >$ Pout
.add1.cca
.anova.cca
.anova
, which contains brief information of steps
taken. You can suppress voluminous output during model building by
setting trace = FALSE
, and find the summary of model history
in the anova
item.add1.cca
and drop1.cca
. With these functions,
ordination models can be chosen with standard Rfunction
step
which bases the term choice on AIC. AIC-like
statistics for ordination are provided by functions
deviance.cca
and extractAIC.cca
(with
similar functions for rda
). Actually, constrained
ordination methods do not have AIC, and therefore the step
may not be trusted. This function provides an alternative using
permutation $P$-values.
Function ordistep
defines the model, scope
of models
considered, and direction
of the procedure similarly as
step
. The function alternates with drop
and
add
steps and stops when the model was not changed during one
step. The -
and +
signs in the summary
table indicate which stage is performed. The number of permutations
is selected adaptively with respect to the defined decision limit. It
is often sensible to have Pout
$>$ Pin
in stepwise
models to avoid cyclic adds and drops of single terms. Function ordiR2step
builds model so that it maximizes adjusted
$R^2$ (function RsquareAdj
) at every step, and
stopping when the adjusted $R^2$ starts to decrease, or the
adjusted $R^2$ of the scope
is exceeded, or the
selected permutation $P$-value is exceeded (Blanchet et
al. 2008). The direction
has choices "forward"
and
"both"
, but it is very excepctional that a term is dropped with
the adjusted $R^2$ criterion. Function uses adjusted
$R^2$ as the criterion, and it cannot be used if the criterion
cannot be calculated. Therefore it is unavailable for
cca
.
Functions ordistep
(based on $P$ values) and ordiR2step
(based on adjusted $R^2$ and hence on eigenvalues) can select
variables in different order.
cca
,
rda
and capscale
. The underlying functions
are add1.cca
and drop1.cca
, and the
function is modelled after standard step
(which also can
be used directly but uses AIC for model choice, see
extractAIC.cca
). Function ordiR2step
builds upon
RsquareAdj
.## See add1.cca for another example
### Dune data
data(dune)
data(dune.env)
mod0 <- rda(dune ~ 1, dune.env) # Model with intercept only
mod1 <- rda(dune ~ ., dune.env) # Model with all explanatory variables
## With scope present, the default direction is "both"
ordistep(mod0, scope = formula(mod1), perm.max = 200)
## Example without scope. Default direction is "backward"
ordistep(mod1, perm.max = 200)
## Example of ordistep, forward
ordistep(mod0, scope = formula(mod1), direction="forward", perm.max = 200)
### Mite data
data(mite)
data(mite.env)
mite.hel = decostand(mite, "hel")
mod0 <- rda(mite.hel ~ 1, mite.env) # Model with intercept only
mod1 <- rda(mite.hel ~ ., mite.env) # Model with all explanatory variables
## Example of ordiR2step with default direction = "both"
## (This never goes "backward" but evaluates included terms.)
step.res <- ordiR2step(mod0, mod1, perm.max = 200)
step.res$anova # Summary table
## Example of ordiR2step with direction = "forward"
step.res <- ordiR2step(mod0, scope = formula(mod1), direction="forward")
step.res$anova # Summary table
Run the code above in your browser using DataLab