% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/score_variables.R
\name{add_suitability_ci}
\alias{add_suitability_ci}
\title{Add bootstrap confidence intervals to suitability scores}
\usage{
add_suitability_ci(
  result,
  tolerances,
  n_boot = 200L,
  uncertainty = NULL,
  seed = 42L,
  verbose = FALSE
)
}
\arguments{
\item{result}{Dataframe returned by \code{\link[=predict_oyster]{predict_oyster()}}.}

\item{tolerances}{Species tolerance list from \code{\link[=get_species_tolerances]{get_species_tolerances()}}.}

\item{n_boot}{Integer. Number of bootstrap resamples (default 200).}

\item{uncertainty}{Named numeric vector. 1-sigma measurement errors by
variable name (e.g. \code{c(temperature = 0.2, salinity = 0.5)}).}

\item{seed}{Integer or NULL. Random seed for reproducibility (default 42).}

\item{verbose}{Logical. Print progress (default FALSE).}
}
\value{
The input dataframe with additional columns:
\code{suit_ci_lower}, \code{suit_ci_upper}, \code{suit_ci_width}.
}
\description{
Re-scores each row of a survey dataframe \code{n_boot} times, each time adding
Gaussian noise to every numeric variable proportional to its measurement
uncertainty, and returns the 5th and 95th percentile suitability scores as
\code{suit_ci_lower} and \code{suit_ci_upper} columns (90\% interval).

Measurement uncertainty is specified via the \code{uncertainty} argument: a named
list where each name matches a variable name in \code{tolerances$scored_factors}
and the value is the 1-sigma absolute error (same units as the variable).
Any variable not listed defaults to 2\% of its observed value.
}
\examples{
\donttest{
result <- predict_oyster(survey, "ostrea_edulis")
tol    <- get_species_tolerances("ostrea_edulis")
result <- add_suitability_ci(result, tol,
                             uncertainty = c(temperature = 0.3,
                                             salinity    = 0.5))
# Columns suit_ci_lower, suit_ci_upper, suit_ci_width now present
generate_report(result, "report.html")   # map rings scale with CI width
}
}
