% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/pch_absolute_risk.R
\name{pch_absolute_risk_euler}
\alias{pch_absolute_risk_euler}
\title{Absolute risk (Euler approximation) for a cause under piecewise-constant hazards}
\usage{
pch_absolute_risk_euler(
  id,
  dt,
  haz,
  cause_idx,
  one_based = TRUE,
  na_is_zero = FALSE
)
}
\arguments{
\item{id}{Integer vector. Sorted by \code{id} then time.}

\item{dt}{Numeric vector of interval lengths.}

\item{haz}{Numeric matrix (n x C) of cause-specific hazards per interval.}

\item{cause_idx}{Integer. Index of the cause of interest (1-based by default).}

\item{one_based}{Logical. If \code{TRUE}, \code{cause_idx} is 1-based. If \code{FALSE}, 0-based.}

\item{na_is_zero}{Logical. If \code{TRUE}, treat NA/Inf hazards as zero.}
}
\value{
Numeric vector of cumulative incidence values (Euler approximation)
at the end of each interval.
}
\description{
Computes the cumulative incidence function using the first-order Euler
(discrete) approximation:
\deqn{F_j(t) \approx \sum S(t_{k-1}) \lambda_{j,k} \Delta t_k}{
    F_j(t) = approx sum S(t_{k-1}) lambda_{j,k} Delta t_k
  }
Grouped by \code{id}, this returns the cumulative incidence at the end of each interval.
}
\examples{
id <- c(1L, 1L, 2L, 2L)
dt <- c(1, 1, 1, 1)
haz <- rbind(
  c(0.10, 0.05),
  c(0.20, 0.10),
  c(0.05, 0.02),
  c(0.10, 0.03)
)
pch_absolute_risk_euler(id = id, dt = dt, haz = haz, cause_idx = 1)

}
