.gen_samples_proportional {valueSetCompare} | R Documentation |
.gen_samples_proportional
Description
The function takes in a dataframe and a column (factor_column) that dictates the groupings. It then generates bootstrap samples ensuring that each sample is proportionally representative of the original dataset based on the given groupings.
Usage
.gen_samples_proportional(
df,
factor_column = "vasdecile",
sample_size = 1000,
number_of_samples = 1000
)
Arguments
df |
A dataframe containing the dataset. |
factor_column |
A string specifying the column name in the dataframe that contains the groupings or factors. |
sample_size |
An integer indicating the size of each bootstrap sample. Default is 1000. |
number_of_samples |
An integer indicating the number of bootstrap samples to generate. Default is 1. |
Value
A matrix containing bootstrap samples with rows corresponding to individual samples and columns corresponding to observations in each sample. The matrix has an attribute "gr" that contains the calculated size for each group to ensure proportional representation.