% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/debtox.R
\name{bdeb_ec50}
\alias{bdeb_ec50}
\title{Extract EC50 and NEC from a DEBtox Fit}
\usage{
bdeb_ec50(fit, prob = 0.9, verbose = TRUE)
}
\arguments{
\item{fit}{A \code{\link[=bdeb_fit]{bdeb_fit()}} object from a DEBtox model.}

\item{prob}{Credible interval probability. Default 0.90.}

\item{verbose}{Logical; if \code{TRUE} (default) the summary table is
printed via \code{\link[cli:cli_verbatim]{cli::cli_verbatim()}} / \code{\link[=message]{message()}} and can be
silenced with \code{\link[=suppressMessages]{suppressMessages()}}.  Set to \code{FALSE} for a silent
run; the invisible return value is identical.}
}
\value{
A named list with:
\itemize{
\item \code{draws}: posterior draws of EC50
\item \code{summary}: mean, median, sd, lower, upper
\item \code{NEC}: posterior summary of the no-effect concentration
}
}
\description{
Extracts the full posterior distribution of the \eqn{\mathrm{EC}_{50}}
and the NEC (no-effect concentration, \eqn{z_w}) from a fitted DEBtox
model.  Both quantities are computed analytically in the Stan
\verb{generated quantities} block, avoiding the need for post-hoc root
finding.  At toxicokinetic steady state the stress factor equals
\eqn{s = b_w(C_w - z_w)} for \eqn{C_w > z_w}, so setting \eqn{s = 0.5}
yields
}
\details{
\deqn{\mathrm{EC}_{50} = z_w + \frac{0.5}{b_w}.}

The NEC is the threshold concentration below which no effect occurs;
it corresponds directly to the parameter \eqn{z_w} in the damage
model of Kooijman & Bedaux (1996).
}
\examples{
\donttest{
if (requireNamespace("cmdstanr", quietly = TRUE) &&
    nzchar(tryCatch(cmdstanr::cmdstan_path(), error = function(e) ""))) {
  data(debtox_growth)
  dat <- bdeb_data(growth = debtox_growth,
                   concentration = c("1" = 0, "11" = 20,
                                    "21" = 80, "31" = 200))
  fit <- bdeb_fit(bdeb_tox(dat, stress = "assimilation"),
                  chains = 2, iter_warmup = 200, iter_sampling = 200,
                  init = 0.5, refresh = 0)
  bdeb_ec50(fit, prob = 0.95)
}
}
}
\references{
Kooijman, S.A.L.M. and Bedaux, J.J.M. (1996). \emph{The Analysis of
Aquatic Toxicity Data}. VU University Press, Amsterdam.
}
