Arguments
- n
- The number of samples required. 
- mu
- A vector with the means for the variables. 
- sigma
- A symmetric, positive-definite matrix with the (co)variance or correlation matrix of the variables. 
- tol
- Tolerance (relative to largest variance) for numerical lack of positive-definiteness in sigma. 
- seed
- An integer value interpreted as seed. 
Author
Tiago Olivoto tiagoolivoto@gmail.com
Examples
# \donttest{
sigma <- matrix(c(1,  .3,  0,
                  .3,   1, .9,
                  0,   .9,  1),3,3)
mu <- c(6,50,5)
df <- get_corvars(n = 10000, mu = mu, sigma = sigma, seed = 101010)
mean_by(df)
#> # A tibble: 1 × 3
#>      X1    X2    X3
#>   <dbl> <dbl> <dbl>
#> 1  6.01  50.0  5.00
cor(df)
#>             X1        X2          X3
#> X1 1.000000000 0.3026515 0.004851063
#> X2 0.302651488 1.0000000 0.900604867
#> X3 0.004851063 0.9006049 1.000000000
# }
