Calculates hazard, cumulative hazard, survival and distribution function based on hazards that are constant over pre-specified time-intervals
subpop_pchaz(
Tint,
lambda1,
lambda2,
lambdaProg,
timezero = FALSE,
int_control = list(rel.tol = .Machine$double.eps^0.4, abs.tol = 1e-09),
discrete_approximation = FALSE
)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\) for piecewise constant hazards before the changing event happens, for the intervals specified via T.
vector of length \(k\) for piecewise constant hazards after the changing event has happened, for the intervals specified via T.
vector of length \(k\) for piecewise constant hazards for the changing event, for the intervals specified via T.
logical, indicating whether after the changeing event the timecount, governing which interval in Tint and which according value in
lambda2 is used, should restart at zero.
A list with the rel.tol and abs.tol paramaters to be passed to the integrate function.
if TRUE, the function uses an approximation based on discretizing the time, instead of integrating. This speeds up the calculations
A list with class mixpch containing the following components:
hazValues of the hazard function.
cumhazValues of the cumulative hazard function.
SValues of the survival function.
FValues of the distribution function.
tTime points for which the values of the different functions are calculated.
TintInput vector of boundaries of time intervals.
lambda1Input vector of piecewise constant hazards before the changing event happen.
lambda2Input vector of piecewise constant hazards after the changing event happen.
lambdaProgInput vector of piecewise constant hazards for the changing event.
funsA list with functions to calculate the hazard, cumulative hazard, survival, and cdf over arbitrary continuous times.
We assume that the time to disease progression \(T_{PD}\) is governed
by a separate process with hazard function \(\eta(t)\),
which does not depend on the hazard function for death \(\lambda(t)\).
\(\eta(t)\), too, may be modelled as piecewise constant or, for simplicity,
as constant over time. We define \(\lambda_{prePD}(t)\) and \(\lambda_{postPD}(t)\)
as the hazard functions for death before and after disease progression.
Conditional on \(T_{PD}=s\), the hazard function for death is
\(\lambda(t|T_{PD}=s)=\lambda_{prePD}(t){I}_{t\leq s}+\lambda_{postPD}(t){I}_{t>s}\).
The conditional survival function is
\(S(t|T_{PD}=s)=\exp(-\int_0^t \lambda(t|T_{PD}=s)ds)\).
The unconditional survival function results from integration over all
possible progression times as \(S(t)=\int_0^t S(t|T_{PD}=s)dP(T_{PD}=s)\).
The output includes the function 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 {
subpop_pchaz(Tint = c(0, 40, 100), lambda1 = c(0.2, 0.4), lambda2 = c(0.1, 0.01),
lambdaProg = c(0.5, 0.4),timezero = FALSE, discrete_approximation = TRUE)
subpop_pchaz(Tint = c(0, 40, 100), lambda1 = c(0.2, 0.4), lambda2 = c(0.1, 0.01),
lambdaProg = c(0.5, 0.4), timezero = TRUE, discrete_approximation = TRUE)
# }
Run the code above in your browser using DataLab