% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/fit_multi.R
\name{fit_multi}
\alias{fit_multi}
\title{Fit models to multiple disease progress curves}
\usage{
fit_multi(
  time_col,
  intensity_col,
  data,
  strata_cols = NULL,
  starting_par = list(y0 = 0.01, r = 0.03, K = 0.8),
  maxiter = 500,
  nlin = FALSE,
  estimate_K = FALSE
)
}
\arguments{
\item{time_col}{Character name specifying the time column.}

\item{intensity_col}{Character name specifying the disease intensity column.}

\item{data}{A data frame containing the variables for model fitting.}

\item{strata_cols}{Character vector specifying grouping columns. Use `NULL`
to fit all rows as a single epidemic. Defaults to `NULL`.}

\item{starting_par}{Named list of starting values for model parameters.}

\item{maxiter}{Maximum number of iterations for nonlinear fitting. Must be a
positive number.}

\item{nlin}{Logical. Should nonlinear fitting be used?}

\item{estimate_K}{Logical. Should the asymptote `K` be estimated?}
}
\value{
A list with grouped parameter estimates and prediction data.
}
\description{
Apply `fit_lin()`, `fit_nlin()`, or `fit_nlin2()` to multiple disease
progress curves stored in a data frame.
}
\examples{
set.seed(1)
epi1 <- sim_gompertz(N = 30, y0 = 0.01, dt = 5, r = 0.3, alpha = 0.2, n = 2)
epi2 <- sim_gompertz(N = 30, y0 = 0.01, dt = 5, r = 0.2, alpha = 0.2, n = 2)
data <- dplyr::bind_rows(epi1, epi2, .id = "curve")
fit_multi(time_col = "time", intensity_col = "random_y", data = data, strata_cols = "curve")
fit_multi(time_col = "time", intensity_col = "random_y", data = data)

}
