% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/ecdf_nonnormal_niche.R
\name{ecdf_nonnormal_niche}
\alias{ecdf_nonnormal_niche}
\title{Compare ECDF and Chi-square suitability under non-normal data}
\usage{
ecdf_nonnormal_niche(
  rho_vals = c(-0.7, -0.3, 0, 0.3, 0.7),
  n_vals = c(20L, 50L, 100L, 200L, 500L),
  n_reps = 10L,
  N_ref = 1e+05,
  temp_function = "qnorm",
  temp_parameters = list(mean = 20, sd = 5),
  prec_function = "qweibull",
  prec_parameters = list(shape = 2, scale = 10),
  seed = NULL
)
}
\arguments{
\item{rho_vals}{Numeric vector; correlations between variables.}

\item{n_vals}{Integer vector; sample sizes.}

\item{n_reps}{Integer; number of replicates.}

\item{N_ref}{Integer; size of reference population for "true" parameters.}

\item{temp_function}{Character; function used to model temperature values. One of: "qnorm" or
"qweibull".}

\item{temp_parameters}{List; list organizing parameters to pass to \code{temp_function}.}

\item{prec_function}{Character; function used to model precipitation values. One of: "qnorm" or
"qweibull".}

\item{prec_parameters}{List; list organizing parameters to pass to \code{temp_function}.}

\item{seed}{Optional integer for reproducibility.}
}
\value{
A list with:
\itemize{
\item suit_plot: ggplot of suitability vs Mahalanobis distance
\item cor_df: correlation results
\item obs_df: observation-level data
}
}
\description{
Script to run a simulation study to compare Chi-square vs. ECDF approaches
to quantify habitat suitability based on bivariate non-normal data.
Bivariate data was simulated based on environmental variables (temperature
and precipitation) using Gaussian copulas. Temperature followed a normal
distribution while precipitation followed a Weibull distribution.
The choices of the distributions were based on Haddad (2021) - Theoretical
and Applied Climatology (for temperature) and on the estimation of rainfall
in milimeters by Wilks (1989) - Journal of Applied Meteorology.
Because the relationship between temperature and precipitation is complex
across space (Rodrigo, 2022 - Theoretical and Applied Climatology), we
defined five correlation values between the two variables.

\code{temp_parameters} and \code{prec_parameters} must comply to \code{stats::qnorm} or
\code{stats::qweibull}, depending on the function chosen on \code{temp_function} and
\code{prec_function}. For \code{"qnorm"}, user can specify \code{mean} and \code{sd}, while
for \code{"qweibull"}
}
\details{
Simulates bivariate environmental data using Gaussian copulas with
non-normal marginals (Normal for temperature and Weibull for precipitation),
and evaluates agreement between chi-squared and ECDF suitability.
}
\examples{
# Create ECDF-niche based on personalized options:
n <- ecdf_nonnormal_niche(rho_vals = c(-0.7, -0.3, 0, 0.3, 0.7),
                          n_vals   = c(20L, 50L, 100L, 200L, 500L),
                          n_reps   = 10L,
                          N_ref    = 1e5,
                          seed     = 1991)

}
\author{
Matheus T. Baumgartner
}
