Niche analysis using ECDF and chi-squared
ecdf_theoretical_niche.RdSimulate niche suitability from Mahalanobis distance using both chi-squared and empirical CDF transformations, for a given number of predictor variables.
Usage
ecdf_theoretical_niche(
n,
n_population = 10000L,
sample_sizes = seq(20L, 500L, 20L),
seed = NULL
)Value
A list with:
corplot: ggplot object with correlation vs sample size.
sample_data: matrix of simulated sample points.
sample_niche: numeric vector of “true” niche suitability.
chisq_suits: numeric vector, 1 - pchisq(Mahalanobis).
ecdf_suits: numeric vector, 1 - ECDF(Mahalanobis).
mahal_dists: numeric vector of Mahalanobis distances.
Examples
# Create ECDF-niche based on personalized options:
n <- ecdf_theoretical_niche(n = 3,
n_population = 20000,
sample_sizes = seq(50, 1000, 50),
seed = 123)