I have a vector of means and a covariance matrix and I'm trying to create a data set that would like to generate strictly positive numbers that would fit the parameters. I have seen quite a few options but all of them resulted in creating some negative observations. I have implemented the following code using the MASS package, but I have also tried the mvtnorm as well as several other options which have not produced the needed results.
means <- c(0.1505, 0.1596, 0.1552)
cov_matrix <- matrix(c(0.23915, -0.04556, -0.04729,
-0.04556, 0.21460, -0.05269,
-0.04729, -0.05269, 0.20674), ncol = 3)
t <- MASS::mvrnorm(n = 50, mu = means, Sigma = cov_matrix, empirical = TRUE)
head(t)
[,1] [,2] [,3]
[1,] 0.1432 0.51024 0.29832
[2,] 1.0483 0.29353 -1.02127
[3,] 0.3252 0.45140 -0.41820
[4,] -0.3459 0.08166 0.04431
[5,] -0.3144 0.29057 0.55096
[6,] 1.1736 -0.63583 -0.56427
I feel as if it should be quite simple and I'm just missing something.