Calculates hazard, cumulative hazard, survival and distribution function based on hazards that are constant over pre-specified time-intervals.
pchaz(Tint, lambda)
vector of length \(k+1\), for the boundaries of \(k\) time intervals (presumably in days) with piecewise constant hazard. The boundaries should be increasing and the first one should
be 0
, the last one should be larger than the assumed trial duration.
vector of length \(k\) with the piecewise constant hazards for the intervals specified via Tint
.
A list with class mixpch
containing the following components:
haz
Values of the hazard function over discrete times t.
cumhaz
Values of the cumulative hazard function over discrete times t.
S
Values of the survival function over discrete times t.
F
Values of the distribution function over discrete times t.
t
Time points for which the values of the different functions are calculated.
Tint
Input vector of boundaries of time intervals.
lambda
Input vector of piecewise constant hazards.
funs
A list with functions to calculate the hazard, cumulative hazard, survival, pdf and cdf over arbitrary continuous times.
Given \(k\) time intervals \([t_{j-1},t_j), j=1,\dots,k\) with
\(0 = t_0 < t_1 \dots < t_k\), the function assume constant hazards \(\lambda_{j}\) at each interval.
The resulting hazard function is
\(\lambda(t) =\sum_{j=1}^k \lambda_{j} {1}_{t \in [t_{j-1},t_j)}\),
the cumulative hazard function is\
\(\Lambda(t) = \int_0^t \lambda(s) ds =\sum_{j=1}^k \left( (t_j-t_{j-1})\lambda_{j} {1}_{t > t_j} + (t-t_{j-1}) \lambda_{j} {1}_{t \in [t_{j-1},t_j) } \right)\)
and the survival function \(S(t) = e^{-\Lambda(t)}\).
The output includes the functions values calculated for all integer time points
between 0 and the maximum of Tint
.
Additionally, a list with functions is also given to calculate the values at any arbitrary point \(t\).
# NOT RUN {
pchaz(Tint = c(0, 40, 100), lambda=c(.02, .05))
# }
Run the code above in your browser using DataLab