| simulate_correlation | R Documentation |
A thin wrapper around simulate_correlated() that supplies defaults for
means and sds, so simulate_correlation(n) generates a single standard
normal variable. structure is forwarded only when it is supplied, which
keeps simulate_correlated()'s own default resolution intact: "custom"
when correlation is given, "exchangeable" when a non-zero rho is
given, and "independent" otherwise.
simulate_correlation(
n,
means = 0,
sds = 1,
rho = 0,
structure = c("independent", "exchangeable", "ar1", "custom"),
correlation = NULL,
variable_names = NULL,
seed = NULL,
batch = NULL
)
n |
Number of observations. |
means, sds, rho, structure, correlation, variable_names, seed |
Arguments passed
to |
batch |
Optional single positive whole number. When given, the
simulator runs |
A simulab_sim base data.frame with one row per observation and
an id column followed by one column per variable. The parameters,
correlation and covariance components hold the requested means and
standard deviations and the tidy correlation and covariance matrices; use
components() to list them.
result <- simulate_correlation(n = 200, means = c(0, 0), sds = c(1, 1), rho = 0.6,
seed = 1)
head(result)
as.data.frame(result, what = "correlation")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.