simulate_group_gaussian {simBKMRdata} | R Documentation |
Simulate Group Multivariate Gaussian Data
Description
This function generates data for each group from a Multivariate Gaussian (Normal) Distribution by invoking this distribution's random generator once per group. It binds the generated data together into a single data frame.
Usage
simulate_group_gaussian(param_list, group_col_name)
Arguments
param_list |
A list of named sublists, where each sublist contains the parameters for a group (sample size, mean, standard deviation, and correlation matrix). The dimension of the parameters for each group must be the same. |
group_col_name |
The column name of the grouping/label column to be
created in the final data frame. The values are taken from the names of the
sublists of |
Value
A data frame with the simulated data for all groups, including the grouping column.
Examples
# Example using MASS::mvrnorm for normal distribution
param_list <- list(
Male = list(
sampSize = 50,
mean_vec = c(1, 2),
sampSD = c(2, 1),
sampCorr_mat = matrix(c(1, 0.5, 0.5, 1), 2, 2)
),
Female = list(
sampSize = 100,
mean_vec = c(2, 3),
sampSD = c(1, 2),
sampCorr_mat = matrix(c(1, 0.3, 0.3, 1), 2, 2)
)
)
simulate_group_gaussian(param_list, "Sex")
[Package simBKMRdata version 0.2.1 Index]