Filter a set of correlated predictors to fewer ones
Source:R/utils-predictors.R
predictor_filter.Rd
This 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
data.frame
ormatrix
with extracted environmental covariates for a given species.- keep
A
vector
with 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 theabess
package (see References). Note that this effectively fits a separate generalized linear model to reduce the number of covariates."boruta"
Uses theBoruta
package to identify non-informative features.