View source: R/continuous_functions_1-1.R
| pop_pchaz | R Documentation |
Calculates hazard, cumulative hazard, survival and distribution function based on hazards that are constant over pre-specified time-intervals
pop_pchaz( Tint, lambdaMat1, lambdaMat2, lambdaProgMat, p, timezero = FALSE, int_control = list(rel.tol = .Machine$double.eps^0.4, abs.tol = 1e-09), discrete_approximation = FALSE )
Tint |
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 |
lambdaMat1 |
matrix of dimension m-by-k, each row contains the vector of piecewise constant hazards for one subpopulation before the changeing event happens, for the intervals speciefied via |
lambdaMat2 |
matrix of dimension m-by-k, each row contains the vector piecewise constant hazards for one subpopulation after the changeing event has happened, for the intervals speciefied via |
lambdaProgMat |
matrix of dimension m-by-k, each row contains the vector of piecewise constant hazards for one subpopulation for the changeing event, for the intervals speciefied via |
p |
vector of length m for relative sizes (proportions) of the subpopulations. They should sum up to 1. |
timezero |
logical, indicating whether after the changing event the timecount, governing which interval in |
int_control |
A list with additional paramaters to be passed to the |
discrete_approximation |
if TRUE, the function uses an approximation based on discretizing the time, instead of integrating. This speeds up the calculations |
Given m subgroups with relative sizes p_1, …, p_m and
subgroup-specific survival functions S{l}(t),
the marginal survival function is the mixture S(t)=∑_{l=1}^m p_l S_{l}(t).
Note that the respective hazard function is not a linear combination of the
subgroup-specific hazard functions.
It may be calculated by the general relation λ(t)=-\frac{dS(t)}{dt}\frac{1}{S(t)}.
In each subgroup, the hazard is modelled as a piecewise constant hazard, with
the possibility to also model disease progression.
Therefore, each row of the hazard rates is used in subpop_pchaz.
See pchaz and subpop_pchaz
for more details.
The output includes the function values calculated for all integer time points
between 0 and the maximum of Tint.
Note: this function may be very slow in cases where many time points need to be calculated. If this happens, use
discrete_approximation = TRUE.
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.
Robin Ristl, robin.ristl@meduniwien.ac.at, Nicolas Ballarini
Robin Ristl, Nicolas Ballarini, Heiko Götte, Armin Schüler, Martin Posch, Franz König. Delayed treatment effects, treatment switching and heterogeneous patient populations: How to design and analyze RCTs in oncology. Pharmaceutical statistics. 2021; 20(1):129-145.
pchaz, subpop_pchaz, plot.mixpch
pop_pchaz(Tint = c(0, 40, 100), lambdaMat1 = matrix(c(0.2, 0.1, 0.4, 0.1), 2, 2), lambdaMat2 = matrix(c(0.5, 0.2, 0.6, 0.2), 2, 2), lambdaProg = matrix(c(0.5, 0.5, 0.4, 0.4), 2, 2), p = c(0.8, 0.2), timezero = FALSE, discrete_approximation = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.