R/Bootstrap_functions.r
bootstrapSamples_limRots_cox.RdThis function generates stratified bootstrap samples similar to
bootstrapSamples_limRots, but additionally supports correlation
blocks. When correlation_block is specified, all samples sharing
the same block ID are always selected together during resampling.
bootstrapSamples_limRots_cox(niter, meta.info, correlation_block = NULL)Integer. The number of bootstrap samples to generate.
Data frame. Metadata containing sample information,
where each row corresponds to a sample. Factor columns in meta.info
are used to define strata for sampling.
Character or NULL. The name of a column in
meta.info that defines correlation blocks. Samples sharing the same
value in this column are always resampled together as a unit.
A matrix of dimension niter x n, where n is the
number of samples. Each row corresponds to a bootstrap sample, and each
entry is a resampled row name from the metadata.
When correlation_block is not NULL, the function groups samples by
their block ID within each group/stratum and resamples entire blocks with
replacement, so that correlated samples (e.g., repeated measures from the
same subject) are always kept together.