Absolute risk (cumulative incidence) for a cause under piecewise-constant hazards
Source:R/pch_absolute_risk.R
pch_absolute_risk.RdComputes, per row, the cumulative incidence function at the end of each interval,
grouped by id. The number of causes is inferred from the number of columns in haz.
Arguments
- id
Integer vector. Sorted by
idthen time.- dt
Numeric vector of interval lengths.
- haz
Numeric matrix (n x C) of cause-specific hazards per interval. Columns correspond to causes 1..C.
- cause_idx
Integer. Index of the cause of interest (1-based by default).
- one_based
Logical. If
TRUE,cause_idxis 1-based. IfFALSE, 0-based.- na_is_zero
Logical. If
TRUE, treat NA/Inf hazards as zero.