% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/adjoint.R
\name{.rxAdjointGradPop}
\alias{.rxAdjointGradPop}
\title{Adjoint gradient of a POPULATION objective (sum over subjects)}
\usage{
.rxAdjointGradPop(
  object,
  params,
  events,
  calcSens,
  pred,
  data,
  errModel = NULL,
  denseBy = 0.01,
  useC = TRUE,
  atol = 1e-10,
  rtol = 1e-10
)
}
\arguments{
\item{object}{model definition accepted by \code{\link[=rxode2]{rxode2()}} (text,
\code{rxode2} object, or function/ui).}

\item{params}{named numeric vector of parameter values.}

\item{events}{event table / data used to define dosing.}

\item{calcSens}{character vector of parameter names to differentiate with
respect to.}

\item{pred}{character prediction expression \code{f} (function of states and
parameters), e.g. \code{"center/v"}.}

\item{data}{data.frame of observations with columns \code{id}, \code{time}, and \code{dv};
one block of rows per subject.  Any additional columns are treated as
per-subject covariates (first value per subject) merged into \code{params}.}

\item{errModel}{\code{NULL} for least squares, or a list with character entries
\code{add} and/or \code{prop} naming the additive / proportional residual-error
parameters, selecting the FOCEi -2LL objective \code{v = add^2 + (prop*f)^2}.}

\item{denseBy}{grid spacing for the forward checkpoint trajectory; smaller
values reduce the covariate-interpolation error.}

\item{useC}{use the C++ sweep (\code{\link[=.rxAdjointGradEvalC]{.rxAdjointGradEvalC()}}); otherwise the R
reference (\code{\link[=.rxAdjointGradEval]{.rxAdjointGradEval()}}).}

\item{atol, rtol}{solver tolerances used for both the forward checkpoint and
the backward sweeps.}
}
\value{
named numeric vector \code{dOFV/dtheta} over \code{calcSens}.
}
\description{
Computes \verb{dOFV/dtheta = sum_subjects dG_i/dtheta} with one backward sweep per
subject.  The symbolic model is built once (\code{\link[=.rxAdjointGradBuild]{.rxAdjointGradBuild()}}) and
reused per subject.
Assumes a shared dosing regimen across subjects.
}
\author{
Matthew L. Fidler
}
\keyword{internal}
