| sim_data | R Documentation |
Simulate data from a multivariate normal distribution.
sim_data(n, k, cor = NULL, exact = TRUE, seed = NULL)
n |
Number of observations (cases). |
k |
Number of variables. Will be ignored if |
cor |
A correlation value or correlation matrix of the variables. Defaults to |
exact |
Ensure the sample correlation matrix to be exact as specified in |
seed |
Random seed for replicable results. Defaults to |
Return a data.frame of simulated data.
cor_matrix()
sim_data_exp()
d1 = sim_data(n=100, k=5, seed=1)
cor_net(d1)
d2 = sim_data(n=100, k=5, cor=0.2, seed=1)
cor_net(d2)
cor.mat = cor_matrix(
1.0, 0.7, 0.3,
0.7, 1.0, 0.5,
0.3, 0.5, 1.0
)
d3 = sim_data(n=100, cor=cor.mat, seed=1)
cor_net(d3)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.