sim_discr {holodeck} | R Documentation |
Simulate co-varying variables with different means by group
Description
To-do: make this work with 'dplyr::group_by()' instead of 'group ='
Usage
sim_discr(.data, n_vars, var, cov, group_means, name = NA, seed = NA)
Arguments
.data |
A dataframe containing a grouping variable column. |
n_vars |
Number of variables to simulate. |
var |
Variance used to construct variance-covariance matrix. |
cov |
Covariance used to construct variance-covariance matrix. |
group_means |
A vector of the same length as the number of grouping variables. |
name |
An optional name to be appended to the column names in the output. |
seed |
An optional seed for random number generation. If 'NA' (default) a random seed will be used. |
Value
a tibble
See Also
Other multivariate normal functions:
sim_cat()
,
sim_covar()
Examples
library(dplyr)
sim_cat(n_obs = 30, n_groups = 3) %>%
group_by(group) %>%
sim_discr(n_vars = 5, var = 1, cov = 0.5, group_means = c(-1, 0, 1), name = "descr")
[Package holodeck version 0.2.2 Index]