pop_pchaz {nph}R Documentation

Calculate survival for piecewise constant hazards with change after random time and mixture of subpopulations

Description

Calculates hazard, cumulative hazard, survival and distribution function based on hazards that are constant over pre-specified time-intervals

Usage

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
)

Arguments

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 0, the last one should be larger than the assumed trial duration.

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 Tint.

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 Tint.

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 Tint.

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 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.

int_control

A list with additional paramaters to be passed to the integrate function.

discrete_approximation

if TRUE, the function uses an approximation based on discretizing the time, instead of integrating. This speeds up the calculations

Details

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.

Value

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.

Author(s)

Robin Ristl, robin.ristl@meduniwien.ac.at, Nicolas Ballarini

References

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.

See Also

pchaz, subpop_pchaz, plot.mixpch

Examples

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)

[Package nph version 2.1 Index]