
Filter a set of correlated predictors to fewer ones
Source:R/utils-predictors.R
predictor_filter.RdThis function helps to remove highly correlated variables from a set of predictors. It supports multiple options some of which require both environmental predictors and observations, others only predictors.
Some of the options require different packages to be pre-installed, such as
ranger or Boruta.
Arguments
- env
A
SpatRasteror alternativelydata.frameormatrixwith extracted environmental covariates for a given species.- keep
A
vectorwith variables to keep regardless. These are usually variables for which prior information is known.- method
Which method to use for constructing the correlation matrix (Options:
'pearson'(Default),'spearman'|'kendal'),"abess", or"boruta".- ...
Other options for a specific method
Value
A character vector of variable names to be excluded. If the
function fails due to some reason return NULL.
Details
Available options are:
"none"No prior variable removal is performed (Default)."pearson","spearman"or"kendall"Makes use of pairwise comparisons to identify and remove highly collinear predictors (Pearson'sr >= 0.7)."abess"A-priori adaptive best subset selection of covariates via theabesspackage (see References). Note that this effectively fits a separate generalized linear model to reduce the number of covariates."boruta"Uses theBorutapackage to identify non-informative features.