FS.wrda {douconca} | R Documentation |
Forward selection of predictor variables using wrda or cca0
Description
Forward selection of predictor variables using wrda or cca0
Usage
## S3 method for class 'wrda'
FS(
mod,
...,
consider = NULL,
permutations = 999,
n_axes = "all",
initial_model = "1",
factor2categories = TRUE,
test = TRUE,
threshold_P = 0.1,
PvalAdjustMethod = "holm",
max_step = 10,
verbose = FALSE
)
Arguments
mod |
initial wrda or cca0 model with at least on predictor variable, |
... |
unused. |
consider |
character vector of names in |
permutations |
a list of control values for the permutations as
returned by the function |
n_axes |
number of eigenvalues to select upon.
The sum of |
initial_model |
character specifying what should be inside
|
factor2categories |
logical, default |
test |
logical; default: |
threshold_P |
significance level, after adjustment for testing multiplicity, for addition of a variable to the model. |
PvalAdjustMethod |
method for correction for multiple testing
in |
max_step |
maximal number of variables selected. |
verbose |
show progress, default: |
Details
The selection is on the basis of the additional fit (inertia) of a variable given the variables already in the model.
The names in consider
may include
transformations of predictor variables, such as log(.)
,
if consider
does not include factors or if factor2categories=FALSE
.
If consider
does include factors, such transformations
give in a error in the default setting (factor2categories=TRUE
).
Value
list with three elements: final...
with selected variables
and model_final
and process
with account of the selection process
If is.numeric(n_axes)
, then the variance in the returned table is
the sum of the n_axes eigenvalues of the current model
(all variables so far included).
Examples
data("dune_trait_env")
# rownames are carried forward in results
rownames(dune_trait_env$comm) <- dune_trait_env$comm$Sites
abun <- dune_trait_env$comm[, -1] # must delete "Sites"
mod <- dc_CA(formulaEnv = abun ~ Moist + Mag,
formulaTraits = ~ F + R + N + L,
dataEnv = dune_trait_env$envir,
dataTraits = dune_trait_env$traits,
verbose = FALSE)
# selection of traits with environmental model of mod (~ Moist+Mag)
out1 <- FS(mod, consider = c("F", "R", "N", "L"),
select = "traits", verbose = FALSE)
names(out1)
out1$finalWithOneExtra
out1$model_final
# selection of environmental variables with trait model of mod (~ F + R + N + L)
out2 <- FS(mod, consider = c("A1", "Moist", "Mag", "Use", "Manure"),
select= "env", verbose = FALSE)
names(out2)
out2$finalWithOneExtra
out2$model_final
# selection of environmental variables without a trait model
# i.e. with a single constraint
mod3 <- cca0(mod$data$Y ~ Moist, data = mod$data$dataEnv)
out3 <- FS(mod3, consider = c("A1", "Moist", "Mag", "Use", "Manure"),
threshold_P = 0.05)
out3$finalWithOneExtra
out3$model_final
# selection of traits without an environmental model
# i.e. with a single constraint
tY <- t(mod$data$Y)
mod4 <- cca0(tY ~ L, data = mod$data$dataTraits)
names(mod$data$dataTraits)
out4 <- FS(mod4,
consider = c("SLA", "Height", "LDMC", "Seedmass", "Lifespan",
"F", "R", "N", "L"))
out4$finalWithOneExtra
out4$model_final