Functions called by BuyseTest
to initialize the arguments.
initializeArgs(alternative, name.call, censoring, cpus, data, endpoint, formula,
keep.comparison, method.tte, method.inference, n.resampling, neutral.as.uninf,
operator, option, prob.alloc, seed, strata, threshold, trace, treatment, type)initializeData(data, type, endpoint, operator, strata, treatment)
initializeFormula(x)
initializeSurvival_Peto(M.Treatment, M.Control, M.delta.Treatment,
M.delta.Control, D.TTE, endpoint, type, threshold, index.strataT,
index.strataC, n.strata)
initializeSurvival_Peron(M.Treatment, M.Control, M.delta.Treatment,
M.delta.Control, D.TTE, endpoint, type, threshold, index.strataT,
index.strataC, n.strata)
initializeArgs
: Normalize the argument
method.tte, neutral.as.uninf, keep.comparison, n.resampling, seed, cpus, trace: set to default value when not specified.
formula: call initializeFormula
to extract arguments.
type: convert to numeric.
censoring: only keep censoring relative to TTE endpoint. Set to NULL
if no TTE endpoint.
threshold: set default threshold to 1e-12 expect for binary variable where it is set to 1/2. the rational being we consider a pair favorable if X>Y ie X>=Y+1e-12. When using a threshold e.g. 5 we want X>=Y+5 and not X>Y+5, especially when the measurement is discrete.
data: convert to data.table object.
method.tte: convert to numeric.
and create Wscheme
.
initializeFormula
: extract treatment
, type
, endpoint
, threshold
, censoring
, operator
, and strata
from the formula.
initializeData
: Divide the dataset into two, one relative to the treatment group and the other relative to the control group.
Merge the strata into one with the interaction variable.
Extract for each strata the index of the observations within each group.
Apply Efron correction (when method.tte is set to Efron), i.e. set the last event to an observed event.
initializeSurvival
: Compute the survival via KM.