Skip to contents

Shows each region of each data set on its own line: how many sampled cells it has, the strongest correlation among the variables and the pair that has it, the number of pairs at or above the regional limit and the largest VIF. Without set the table describes all candidate variables (most regions then hold a collinear pair, which is why sets are searched); with set it describes that set, e.g. the one you chose, and passes says whether it keeps the regional limits there.

Usage

correlation_by_region(x, set = NULL)

Arguments

x

A var_selection from select_variables() run on a sample with regions (see sample_environment()).

set

Optional variables (a character vector, or one string with names separated by spaces, as in best_sets()).

Value

A data.frame with data_set, region, cells, screened (FALSE for regions with fewer than min_region_n cells, which are not used), max_abs_rho, pair, pairs_above, max_vif and passes; NULL when the selection has no regions.

References

Dormann, C.F., Elith, J., Bacher, S., et al. (2013) Collinearity: a review of methods to deal with it and a simulation study evaluating their performance. Ecography 36, 27-46. doi:10.1111/j.1600-0587.2012.07348.x

Examples

sim <- simulate_enm_data(seed = 1)
e1 <- sim$env[["env1"]]
e2 <- sim$env[["env2"]]
now <- c(e1, e2, e1 + e2 + 0.05 * e1 * e2, e1 * e2, sqrt(e2))
names(now) <- c("t", "p", "tp", "txp", "sp")
past <- now - 0.2 * now[["t"]]
names(past) <- names(now)
# two regions: west and east of 19 degrees
es <- sample_environment(list(present = now, past = past), n = 3000,
                         regions = list(x = c(14, 19, 24), y = c(49, 55)),
                         seed = 1, verbose = FALSE)
vs <- select_variables(es, sizes = 2:3, min_region_n = 500)
#> Criteria not available for these data (left out): agreement_min
correlation_by_region(vs)                          # all variables
#>   data_set region cells screened why_not max_abs_rho   pair pairs_above
#> 1  present  x1_y1  1493     TRUE           1.0000000 p ~ sp           4
#> 2  present  x2_y1  1507     TRUE           1.0000000 p ~ sp           6
#> 3     past  x1_y1  1532     TRUE           0.9987209 p ~ sp           4
#> 4     past  x2_y1  1468     TRUE           0.9987594 p ~ sp           6
#>    max_vif passes
#> 1      Inf  FALSE
#> 2      Inf  FALSE
#> 3 1134.523  FALSE
#> 4 1861.736  FALSE
correlation_by_region(vs, best_sets(vs)$set[1])    # the best set
#>   data_set region cells screened why_not max_abs_rho  pair pairs_above  max_vif
#> 1  present  x1_y1  1493     TRUE         0.009723389 t ~ p           0 1.000095
#> 2  present  x2_y1  1507     TRUE         0.019482508 t ~ p           0 1.000380
#> 3     past  x1_y1  1532     TRUE         0.089485046 t ~ p           0 1.008072
#> 4     past  x2_y1  1468     TRUE         0.101652228 t ~ p           0 1.010441
#>   passes
#> 1   TRUE
#> 2   TRUE
#> 3   TRUE
#> 4   TRUE