% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/data_prep.R
\name{repro_to_intervals}
\alias{repro_to_intervals}
\title{Convert Cumulative Reproduction to Intervals}
\usage{
repro_to_intervals(df)
}
\arguments{
\item{df}{Data frame with columns: \code{id}, \code{time}, \code{cumulative}.}
}
\value{
Data frame with columns: \code{id}, \code{t_start}, \code{t_end}, \code{count}.
}
\description{
Many ecotoxicological protocols (e.g., ISO 11267 for \emph{Folsomia candida},
OECD 222 for \emph{Eisenia fetida}) report cumulative offspring counts at
successive observation times.  The DEB reproduction buffer model, however,
requires interval counts \eqn{\Delta R = R(t_{\mathrm{end}}) -
R(t_{\mathrm{start}})} so that the negative-binomial likelihood can be
applied to each counting period.  This function computes the
first-difference per individual.
}
\examples{
cumul <- data.frame(
  id = rep(1, 5),
  time = c(0, 7, 14, 21, 28),
  cumulative = c(0, 10, 30, 60, 100)
)
repro_to_intervals(cumul)
}
