Computes the hazard function of a piecewise exponential (pwexp) distribution for progressive disease (PD), such that the resulting hazard function for progression-free survival (PFS) closely matches a given pwexp hazard for PFS.
hazard_pd(
piecewiseSurvivalTime = 0,
hazard_pfs = 0.0578,
hazard_os = 0.02,
corr_pd_os = 0.5
)
A numeric vector representing the estimated hazard rates for the pwexp distribution of PD.
A vector that specifies the starting time of
piecewise exponential survival time intervals. Must start with 0, e.g.,
c(0, 6)
breaks the time axis into 2 event intervals:
[0, 6) and [6, Inf).
Defaults to 0 for exponential distribution.
A scalar or numeric vector specifying the hazard(s) for PFS based on a pwexp distribution.
A scalar or numeric vector specifying the hazard(s) for overall survival (OS) based on a pwexp distribution.
A numeric value specifying the correlation between PD and OS times.
Kaifeng Lu (kaifenglu@gmail.com)
This function determines the hazard vector \(\lambda_{\text{pd}}\) for the pwexp distribution of PD, so that the implied survival function for PFS time, \(T_{\text{pfs}} = \min(T_{\text{pd}}, T_{\text{os}})\), closely matches the specified pwexp distribution for PFS with hazard vector \(\lambda_{\text{pfs}}\).
To achieve this, we simulate \((Z_{\text{pd}}, Z_{\text{os}})\) from a standard bivariate normal distribution with correlation \(\rho\). Then, \(U_{\text{pd}} = \Phi(Z_{\text{pd}})\) and \(U_{\text{os}} = \Phi(Z_{\text{os}})\) are generated, where \(\Phi\) denotes the standard normal CDF.
The times to PD and OS are obtained via the inverse transform
method using quantile functions of the pwexp distribution:
$$T_{\text{pd}} = \text{qpwexp}(U_{\text{pd}},u,\lambda_{\text{pd}})$$
$$T_{\text{os}} = \text{qpwexp}(U_{\text{os}},u,\lambda_{\text{os}})$$
where u = piecewiseSurvivalTime
.
The function solves for \(\lambda_{\text{pd}}\) such that the survival function of \(T_{\text{pfs}}\) closely matches that of a pwexp distribution with hazard \(\lambda_{\text{pfs}}\): $$P(\min(T_{\text{pd}}, T_{\text{os}}) > t) = S_{\text{pfs}}(t)$$ Since $$Z_{\text{pd}} = \Phi^{-1}(\text{ppwexp}(T_\text{pd}, u, \lambda_{\text{pd}}))$$ and $$Z_{\text{os}} = \Phi^{-1}(\text{ppwexp}(T_\text{os}, u, \lambda_{\text{os}}))$$ we have $$P(\min(T_{\text{pd}}, T_{\text{os}}) > t) = P(Z_{\text{pd}} > \Phi^{-1}(\text{ppwexp}(t,u,\lambda_{\text{pd}})), Z_{\text{os}} > \Phi^{-1}(\text{ppwexp}(t,u,\lambda_{\text{os}})))$$ while $$S_{\text{pfs}}(t) = 1 - \text{ppwexp}(t,u,\lambda_{\text{pfs}})$$
Matching is performed sequentially at the internal cutpoints \(u_2, ..., u_J\) and at the point \(u_J + \log(2)/\lambda_{\text{pfs},J}\) for the final interval to solve for \(\lambda_{\text{pd},1}, \ldots, \lambda_{\text{pd},J-1}\) and \(\lambda_{\text{pd},J}\), respectively.
u <- c(0, 1, 3, 4)
lambda1 <- c(0.0151, 0.0403, 0.0501, 0.0558)
lambda2 <- 0.0145
rho <- 0.5
hazard_pd(u, lambda1, lambda2, rho)
Run the code above in your browser using DataLab