bootstrap_helper | R Documentation |
This internal function bootstraps the observed data (i.e., resamples the observed data set with replacement to construct bootstrap confidence intervals and standard errors). Then, the function simulates data using the resampled dataset to estimate the survival outcome, binary end-of-follow-up outcome, or continuous end-of-follow-up outcome.
bootstrap_helper(
r,
time_points,
obs_data,
bootseeds,
outcome_type,
intvars,
interventions,
int_times,
ref_int,
covparams,
covnames,
covtypes,
covfits_custom,
covpredict_custom,
basecovs,
histvars,
histvals,
histories,
ymodel,
ymodel_fit_custom,
ymodel_predict_custom,
yrestrictions,
compevent_restrictions,
restrictions,
comprisk,
compevent_model,
time_name,
outcome_name,
compevent_name,
ranges,
parallel,
ncores,
max_visits,
hazardratio,
intcomp,
boot_diag,
nsimul,
baselags,
below_zero_indicator,
min_time,
show_progress,
pb,
int_visit_type,
sim_trunc,
...
)
r |
Integer specifying the index of the current iteration of the bootstrap. |
time_points |
Number of time points to simulate. |
obs_data |
Data table containing the observed data. |
bootseeds |
Vector of integers specifying the seeds. One seed is used to initialize each bootstrap iteration. |
outcome_type |
Character string specifying the "type" of the outcome. The possible "types" are: |
intvars |
List, whose elements are vectors of character strings. The kth vector in |
interventions |
List, whose elements are lists of vectors. Each list in |
int_times |
List, whose elements are lists of vectors. The kth list in |
ref_int |
Integer denoting the intervention to be used as the
reference for calculating the risk ratio and risk difference. 0 denotes the
natural course, while subsequent integers denote user-specified
interventions in the order that they are
named in |
covparams |
List of vectors, where each vector contains information for
one parameter used in the modeling of the time-varying covariates (e.g.,
model statement, family, link function, etc.). Each vector
must be the same length as |
covnames |
Vector of character strings specifying the names of the time-varying covariates in |
covtypes |
Vector of character strings specifying the "type" of each time-varying covariate included in |
covfits_custom |
Vector containing custom fit functions for time-varying covariates that
do not fall within the pre-defined covariate types. It should be in
the same order |
covpredict_custom |
Vector containing custom prediction functions for time-varying
covariates that do not fall within the pre-defined covariate types.
It should be in the same order as |
basecovs |
Vector of character strings specifying the names of baseline covariates in |
histvars |
List of vectors. The kth vector specifies the names of the variables for which the kth history function
in |
histvals |
List of length two. The first element is a numeric vector specifying the lags used in the model statements (e.g., if |
histories |
Vector of history functions to apply to the variables specified in |
ymodel |
Model statement for the outcome variable. |
ymodel_fit_custom |
Function specifying a custom outcome model. See the vignette "Using Custom Outcome Models in gfoRmula" for details. |
ymodel_predict_custom |
Function obtaining predictions from the custom outcome model specified in |
yrestrictions |
List of vectors. Each vector containins as its first entry
a condition and its second entry an integer. When the
condition is |
compevent_restrictions |
List of vectors. Each vector containins as its first entry
a condition and its second entry an integer. When the
condition is |
restrictions |
List of vectors. Each vector contains as its first entry a covariate for which
a priori knowledge of its distribution is available; its second entry a condition
under which no knowledge of its distribution is available and that must be |
comprisk |
Logical scalar indicating the presence of a competing event. |
compevent_model |
Model statement for the competing event variable. |
time_name |
Character string specifying the name of the time variable in |
outcome_name |
Character string specifying the name of the outcome variable in |
compevent_name |
Character string specifying the name of the competing event variable in |
ranges |
List of vectors. Each vector contains the minimum and
maximum values of one of the covariates in |
parallel |
Logical scalar indicating whether to parallelize simulations of different interventions to multiple cores. |
ncores |
Integer specifying the number of cores to use in parallel simulation. |
max_visits |
A vector of one or more values denoting the maximum number of times
a binary covariate representing a visit process may be missed before
the individual is censored from the data (in the observed data) or
a visit is forced (in the simulated data). Multiple values exist in the
vector when the modeling of more than covariate is attached to a visit
process. A value of |
hazardratio |
Logical scalar indicating whether the hazard ratio should be computed between two interventions. |
intcomp |
List of two numbers indicating a pair of interventions to be compared by a hazard ratio.
The default is |
boot_diag |
Logical scalar indicating whether to return the coefficients, standard errors, and variance-covariance matrices of the parameters of the fitted models in the bootstrap samples. The default is |
nsimul |
Number of subjects for whom to simulate data. By default, this argument is set
equal to the number of subjects in |
baselags |
Logical scalar for specifying the convention used for lagi and lag_cumavgi terms in the model statements when pre-baseline times are not
included in |
below_zero_indicator |
Logical scalar indicating whether the observed data set contains rows for time |
min_time |
Numeric scalar specifying lowest value of time |
show_progress |
Logical scalar indicating whether to print a progress bar for the number of bootstrap samples completed in the R console. This argument is only applicable when |
pb |
Progress bar R6 object. See |
int_visit_type |
Vector of logicals. The kth element is a logical specifying whether to carry forward the intervened value (rather than the natural value) of the treatment variables(s) when performing a carry forward restriction type for the kth intervention in |
sim_trunc |
Logical scalar indicating whether to truncate simulated covariates to their range in the observed data set. This argument is only applicable for covariates of type |
... |
Other arguments |
A list with the following components:
Result |
Matrix containing risks over time under the natural course and under each user-specific intervention. |
ResultRatio |
Matrix containing risk ratios over time under the natural course and under each user-specific intervention. |
ResultDiff |
Matrix containing risk differences over time under the natural course and under each user-specific intervention. |
bootcoeffs |
List of the coefficients of the fitted models. If the argument |
bootstderrs |
List of the standard errors of the coefficients of the fitted models. If the argument |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.