generate_study_data {mmibain}R Documentation

Generate Study Data for RepliCrisis

Description

This function simulates data for the Replication Crisis study by drawing samples from normal distributions defined by the card values.

Usage

generate_study_data(x, sample_size)

Arguments

x

A matrix with two rows representing the mean and standard deviation for each group.

sample_size

The number of samples to draw for each study group.

Details

The function expects a matrix x generated from deal_cards_to_rc_grid() where the first row contains mean values and the second row contains standard deviation values. It then generates sample_size number of normal random values for each group, using the respective mean and standard deviation. The resulting data frame has two columns: one for the group labels and one for the generated values.

The group labels are factors with levels corresponding to the column numbers prefixed by 'Col'. The generated values are numeric and simulate the data that would be collected in the study. The function uses the rnorm function from the stats package for generating random samples.

Value

A data frame containing the simulated study data. Each row corresponds to a single sample and includes the group label and the sampled value.

Examples

study_data <- generate_study_data(x = deal_cards_to_rc_grid(n = 3),
                                  sample_size = 30)

[Package mmibain version 0.1.1 Index]