constrain_survprob {psm3mkv} | R Documentation |
Constrain survival probabilities according to hazards in a lifetable Recalculated constrained survival probabilities (by week) as the lower of the original unadjusted survival probability and the survival implied by the given lifetable (assumed indexed as years).
Description
Constrain survival probabilities according to hazards in a lifetable Recalculated constrained survival probabilities (by week) as the lower of the original unadjusted survival probability and the survival implied by the given lifetable (assumed indexed as years).
Usage
constrain_survprob(
survprob1,
survprob2 = NA,
lifetable = NA,
timevec = 0:(length(survprob1) - 1)
)
Arguments
survprob1 |
(Unconstrained) survival probability value or vector |
survprob2 |
Optional survival probability value or vector to constrain on (default = NA) |
lifetable |
Lifetable (default = NA) |
timevec |
Vector of times corresponding with survival probabilities above |
Value
Vector of constrained survival probabilities
Examples
ltable <- tibble::tibble(lttime=0:20, lx=c(1,0.08,0.05,0.03,0.01,rep(0,16)))
survprob <- c(1,0.5,0.4,0.2,0)
constrain_survprob(survprob, lifetable=ltable)
timevec <- 100*(0:4)
constrain_survprob(survprob, lifetable=ltable, timevec=timevec)
survprob2 <- c(1,0.45,0.35,0.15,0)
constrain_survprob(survprob, survprob2)
[Package psm3mkv version 0.3.2 Index]