H_pw {VirtualPop}R Documentation

Computes Cumulative Hazard at Duration t under a Piecewise Exponential Model

Description

Computes cumulative hazard at duration t from piecewise-constant rates.

Usage

H_pw(t, breakpoints, rates)

Arguments

t

Duration at which cumulative hazard is required. It may be a vector of durations.

breakpoints

Breakpoints: values of time at which piecewise-constant rates change.

rates

Piecewise-constant rates

Value

Cumulative hazard at duration t

See Also

functions pw_root() and r_pw_exp(): Function H_pw() is called by pw_root(), which is called by r_pw_exp().

Examples

# Example 1
breakpoints <- c(0, 10, 20, 30, 60)
rates <- c(0.01,0.02,0.04,0.15)
z <- VirtualPop::H_pw(t=0:40, breakpoints=breakpoints, rates=rates)

# Example 2
utils::data(rates,package="VirtualPop")
ages <- as.numeric(rownames(rates$ASDR))
breakpoints <- c(ages,120)
zz <- VirtualPop::H_pw(t=ages, breakpoints=breakpoints, rates=rates$ASDR[,1])



[Package VirtualPop version 2.0.2 Index]