Adds a group of variables (columns) with a given variance and covariance to a data frame or tibble
Usage
sim_covar(.data = NULL, n_obs = NULL, n_vars, var, cov, name = NA, seed = NA)
Value
a tibble
Arguments
.data
An optional dataframe. If a dataframe is supplied, simulated categorical data will be added to the dataframe. Either `.data` or `n_obs` must be supplied.
n_obs
Total number of observations/rows to simulate if `.data` is not supplied.
n_vars
Number of variables to simulate.
var
Variance used to construct variance-covariance matrix.
cov
Covariance used to construct variance-covariance matrix.
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.
See Also
sim_cat, sim_discr
Other multivariate normal functions:
sim_cat(),
sim_discr()