Learn R Programming

tipse (version 1.2)

impute_random: Model-free imputation via random sampling

Description

randomly sample from the percentile of best or worst patients (ordered by their observed times regardless of event or censoring) who do not require imputation.

Usage

impute_random(dat, reason, impute, percentile, J, seed = NULL)

Value

a list of data.frame from each imputation with imputed AVAL and EVENT, where original variables are kept as AVALo and EVENTo.

Arguments

dat

data.frame containing at least 5 columns: TRT01P (treatment arm as factor), AVAL (survival time), EVENT (event indicator), CNSRRS (censoring reason) and MAXAVAL (maximum potential survival time, duration between randomization to data cut-off)

reason

a string specifying the censoring reasons which require imputation. It must be one of the reasons from variable CNSRRS.

impute

a string specifying the treatment arm(s) which require imputation. It must be one of the arms from variable TRT01P, the first level of TRT01P is considered as the control arm.

percentile

numeric between 1 and 100, indicating the best (or worst) percentile of subjects to sample from.

J

numeric indicating number of imputations.

seed

Integer. Random seed for reproducibility.

Details

We define two sets of subjects to sample from depending on the impute argument:

  1. Worst percentile of observations from treatment arm \( \forall i \in N \mid \min\{T_i, C_i\} \leq F_{\min\{T_i, C_i\}}^{-1}(\kappa) \). This set includes all indices \( i \) where the minimum of \( T_i \) (event time) and \( C_i \) (censoring time) is less than or equal to the \(\kappa\)-th percentile of its distribution.

  2. Best percentile of observations control arm \( \forall i \in N \mid \min\{T_i, C_i\} \geq F_{\min\{T_i, C_i\}}^{-1}(\kappa) \). This set includes all indices \( i \) where the minimum of \( T_i \) and \( C_i \) is greater than or equal to the \(\kappa\)-th percentile of its distribution.

where \( F(\cdot) \) denotes the cumulative distribution function (CDF) of the observed times and \(F^{-1}(\kappa) \) is the inverse CDF (quantile function) at percentile \(\kappa\).