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
)
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.
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 Tint
.
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 Tint
.
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 Tint
.
vector of length \(m\) for relative sizes (proportions) of the subpopulations. They should sum up to 1.
logical, indicating whether after the changing event the timecount, governing which interval in Tint
and which according value in
lambda2
is used, should restart at zero. This argument is either of length 1 (applying the same to all subgroups) or the same length as the number of subgroups.
A list with additional 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:
haz
Values of the hazard function.
cumhaz
Values of the cumulative hazard function.
S
Values of the survival function.
F
Values of the distribution function.
t
Time points for which the values of the different functions are calculated.
Given \(m\) subgroups with relative sizes \(p_1, \dots, p_m\) and
subgroup-specific survival functions \(S{l}(t)\),
the marginal survival function is the mixture \(S(t)=\sum_{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 \(\lambda(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
.
Robin Ristl, Nicolas Ballarini, Heiko G<U+00F6>tte, Armin Sch<U+00FC>ler, Martin Posch, Franz K<U+00F6>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.
# NOT RUN {
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)
# }
Run the code above in your browser using DataLab