correlation_finder {tenm}R Documentation

Function to find strong correlations within environmental predictors

Description

This function identifies variables with strong correlations based on a specified threshold.

Usage

correlation_finder(
  environmental_data,
  method = "spearman",
  threshold,
  verbose = TRUE
)

Arguments

environmental_data

A matrix or data.frame containing environmental data.

method

Method used to estimate the correlation matrix. Possible options include "spearman" (Spearman's rank correlation), "pearson" (Pearson's correlation), or "kendall" (Kendall's tau correlation).

threshold

Correlation threshold value. Variables with absolute correlation values greater than or equal to this threshold are considered strongly correlated.

verbose

Logical. If TRUE, prints verbose output detailing correlations.

Value

A list with two elements:

Examples



library(tenm)
data("abronia")
tempora_layers_dir <- system.file("extdata/bio",package = "tenm")
abt <- tenm::sp_temporal_data(occs = abronia,
                              longitude = "decimalLongitude",
                              latitude = "decimalLatitude",
                              sp_date_var = "year",
                              occ_date_format="y",
                              layers_date_format= "y",
                              layers_by_date_dir = tempora_layers_dir,
                              layers_ext="*.tif$")
abtc <- tenm::clean_dup_by_date(abt,threshold = 10/60)
future::plan("multisession",workers=2)
abex <- tenm::ex_by_date(abtc,train_prop=0.7)
future::plan("sequential")
envdata <- abex$env_data[,-ncol(abex$env_data)]
ecors <- tenm::correlation_finder(environmental_data =envdata,
                                  method="spearman",
                                  threshold = 0.7 )



[Package tenm version 0.5.1 Index]