This function generates stratified bootstrap samples identical 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. When correlation_block is NULL, the function delegates entirely to bootstrapSamples_limRots.

bootstrapSamples_limRots_block(
  niter,
  meta.info,
  group,
  correlation_block = NULL
)

Arguments

niter

Integer. The number of bootstrap samples to generate.

meta.info

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.

group

Character. The name of the column in meta.info that defines the grouping variable for the samples.

correlation_block

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. If NULL, the function behaves identically to bootstrapSamples_limRots.

Value

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, stratified by group and additional factors.

Details

The function follows the same logic as bootstrapSamples_limRots: within each group defined by group, it identifies factor columns to create strata, then samples proportionally within each stratum. When correlation_block is not NULL, entire blocks (e.g., repeated measures from the same subject) are resampled together as a unit instead of individual samples.