Returns the \(B \times N\) integer count matrix consumed by the
infinitesimal-jackknife variance estimator in get_dfRes.
Entry \((b, j)\) is the number of times row \(j\) of df was
selected on bootstrap iteration \(b\).
Usage
bootstrap_ystar(df, nb_boots, seed = 8316951L)
Arguments
- df
Data frame. Counts are computed by positional row index;
df is used only for its row count.
- nb_boots
Integer. Number of bootstrap samples.
- seed
Integer or NULL. Random seed for reproducibility.
Default 8316951L.
Value
Integer matrix with nb_boots rows and nrow(df)
columns.
Implementation note (v0.2.0)
This function previously generated the count matrix via a parallel
foreach pass, with counts derived by matching against a
user-supplied id column. It now runs on the main process and
counts by positional row index via tabulate,
matching how bootstrap_results constructs bootstrap data
(df[in_boot, ]). For data with unique subject ids (the standard
clinical-trial case) the two implementations are equivalent. The new
implementation is also robust to non-unique id values.
Reproducibility note
Bootstrap indices generated by this version are not bit-identical to
those produced by v0.1.x for the same seed (the generator now uses the
main-process Mersenne-Twister stream rather than per-task L'Ecuyer
streams). Statistical properties of bootstrap summaries are preserved.
Examples
if (FALSE) { # \dontrun{
df <- data.frame(id = 1:50, tte = rexp(50), event = rbinom(50, 1, 0.6),
treat = rep(0:1, 25))
ystar <- bootstrap_ystar(df, nb_boots = 10)
dim(ystar) # 10 x 50
rowSums(ystar) # all equal to 50
} # }