select_vars: Find, optionally remove, highly correlated variables from a...

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

select_varsR Documentation

Find, optionally remove, highly correlated variables from a raster brick/stack

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

select_vars(
  env = NULL,
  cutoff = 0.9,
  corr.mat = NULL,
  sample.size = NULL,
  names.only = F,
  plot.dend = T,
  rm.old = F,
  sp.nm = "sp",
  filename = NULL
)

Arguments

env

raster brick/stack

cutoff

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

corr.mat

Correlation matrix from which variables will be selected. If the correlation matrix was already computed from env, you can just input here and choose other cutoff values for selecting variable layers.

sample.size

Numeric. Number of cells of each layer to be sampled and used for computing correlation. If NULL (default), all cells are used to compute correlation. between variables.

names.only

Logical. Return only the names of selected variables (T) or return the raster brick containing the least correlated variables (F).

plot.dend

Logical. Plot dendrogram of correlation distance between variables, showing cutoff limit and selected (black) and discarded (red) variables

rm.old

Logical. Remove (T) old env variables from folder?

sp.nm

Species name. Used to name the output folder

filename

Output filename

Details

This function creates a correlation matrix for the layers of a raster brick/stack, then searches for pair-wise correlations above the cutoff, eliminates variables with most pair-wise correlations and retains the largest number of variables with pair-wise correlation below the cutoff Optionally, a raster brick containing only the variables with correlation below the cutoff is returned.

See Also

select_vars_b, correlated, findCorrelation


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