% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/pch_survival.R
\name{pch_survival}
\alias{pch_survival}
\title{Piecewise-constant hazards survival function}
\usage{
pch_survival(id, dt, haz, na_is_zero = FALSE)
}
\arguments{
\item{id}{Integer vector of subject IDs, sorted by id then time.}

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

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

\item{na_is_zero}{Logical. If TRUE, treat NA hazards as zero.}
}
\value{
Numeric vector of survival probabilities at the end of each interval.
}
\description{
Computes survival at the end of each interval for competing risks with
piecewise constant hazards.
}
\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_survival(id = id, dt = dt, haz = haz)

}
