.gen_samples_proportional | R Documentation |
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.
.gen_samples_proportional(
df,
factor_column = "vasdecile",
sample_size = 1000,
number_of_samples = 1000
)
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. |
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.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.