subpop_pchaz: Calculate survival for piecewise constant hazards with change...

View source: R/continuous_functions_1-1.R

subpop_pchazR Documentation

Calculate survival for piecewise constant hazards with change after random time

Description

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

Usage

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
)

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.

lambda1

vector of length k for piecewise constant hazards before the changing event happens, for the intervals specified via T.

lambda2

vector of length k for piecewise constant hazards after the changing event has happened, for the intervals specified via T.

lambdaProg

vector of length k for piecewise constant hazards for the changing event, for the intervals specified via T.

timezero

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.

int_control

A list with the rel.tol and abs.tol 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

We assume that the time to disease progression T_{PD} is governed by a separate process with hazard function η(t), which does not depend on the hazard function for death λ(t). η(t), too, may be modelled as piecewise constant or, for simplicity, as constant over time. We define λ_{prePD}(t) and λ_{postPD}(t) as the hazard functions for death before and after disease progression. Conditional on T_{PD}=s, the hazard function for death is λ(t|T_{PD}=s)=λ_{prePD}(t){I}_{t≤q s}+λ_{postPD}(t){I}_{t>s}. The conditional survival function is S(t|T_{PD}=s)=\exp(-\int_0^t λ(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.

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.

Tint

Input vector of boundaries of time intervals.

lambda1

Input vector of piecewise constant hazards before the changing event happen.

lambda2

Input vector of piecewise constant hazards after the changing event happen.

lambdaProg

Input vector of piecewise constant hazards for the changing event.

funs

A list with functions to calculate the hazard, cumulative hazard, survival, and cdf over arbitrary continuous times.

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, pop_pchaz, plot.mixpch

Examples

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)

nph documentation built on May 17, 2022, 1:06 a.m.