% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/fit_nlin2.R
\name{fit_nlin2}
\alias{fit_nlin2}
\title{Fit epidemic models and estimate the asymptote}
\usage{
fit_nlin2(
  time,
  y,
  starting_par = list(y0 = 0.01, r = 0.03, K = 0.8),
  maxiter = 50
)
}
\arguments{
\item{time}{Numeric vector of assessment times.}

\item{y}{Numeric vector of disease intensity values.}

\item{starting_par}{Named list with starting values for `y0`, `r`, and `K`.
When omitted or partially specified, `epifitter` supplies data-driven
fallback values.}

\item{maxiter}{Maximum number of iterations. Must be a positive number.}
}
\value{
A list with fit statistics, parameter estimates, and prediction
  data.
}
\description{
Fit monomolecular, logistic, and Gompertz epidemic models using nonlinear
regression while also estimating the maximum disease intensity parameter `K`.
}
\examples{
set.seed(1)
epi <- sim_logistic(N = 30, y0 = 0.01, dt = 5, r = 0.3, alpha = 0.5, n = 4)
fit_nlin2(
  time = epi$time,
  y = epi$random_y * 0.8,
  starting_par = list(y0 = 0.01, r = 0.1, K = 0.8),
  maxiter = 1024
)

}
