Learn R Programming

FARS (version 0.7.1)

compute_subsample: Compute Subsample of Data by Block

Description

Selects a random subset of columns within each block of the input data matrix.

Usage

compute_subsample(data, block_ind, n, sample_size = 1, seed = NULL)

Value

A list with two elements:

sample_data

A numeric matrix combining the sampled columns from all blocks.

sample_block_ind

An integer vector containing the indices corresponding to the sampled data.

Arguments

data

A numeric matrix or data frame containing the original data.

block_ind

Integer vector specifying the end indices of each block. If NULL, assumes a single block spanning all columns.

n

Integer specifying the number of blocks.

sample_size

Numeric between 0 and 1 specifying the proportion of columns to sample within each block. Defaults to 1 (all columns).

seed

Optional integer. Seed for reproducibility of the column sampling. If NULL, sampling is random.