correlated: Find highly correlated variables

View source: R/1.2b.f.sel.env.R

correlatedR Documentation

Find highly correlated variables

Description

This function creates a correlation matrix for the layers of a raster brick/stack and returns a brick containing the least correlated variables below the cutoff value.

Usage

correlated(corr.mat, cutoff = 0.9, names = F)

Arguments

corr.mat

A correlation matrix

cutoff

A numeric value for the pair-wise absolute correlation cutoff.

names

Logical. Should variable names or indexes be returned?

Details

The function finds variables with correlation above the cutoff and sucessively picks up the variable with the largest number of pair-wise correlations above the cutoff. At each step, the variable is assigned to a group containing all variables with at least one correlated variable in common. The variable with the largest within group mean correlation is discarded.

Value

A vector of variable names (when names = TRUE) or variable/column indexes (when names = F). If there are no correlations above the cutoff, all variable names (or indexes) is returned

See Also

select_vars_b, select_vars, findCorrelation


HemingNM/ENMwizard documentation built on Jan. 4, 2024, 3:24 p.m.