HI
how to simulation data from a MULTIVARIATE log-normal distribution with mean
{1,1,1} and cov-variance{1 -0.2 0.4, -0.2 1 0.5, 0.4 0.5 1} in GAUSS
THANKS A LOT!
1 Answer
0
You can use the rndMVn and exp functions to create multivariate lognormally distributed random deviates. For example:
//Covariance matrix cov = { 1 0.6, 0.6 1 }; //Mean for each column mean = { 1, 1 }; //Create multivariate random normal numbers,/span> x = rndMVn(1e6, mean, cov); //normal -> lognormal x_lognorm = exp(x);
You can calculate the mean and variance like this:
//Mean for normal numbers above mean = 1; //Variance for normal numbers above variance = 1; mean_lognorm = exp(mean + variance./2); var_lognorm = (exp(variance) - 1) .* exp(2 .* mean + variance);
Based on the formulas above, the mean and variance for our example in the first code snippet should be approximately 4.48 and 34.51 (with a standard deviation of about 5.87).
Your Answer
1 Answer
You can use the rndMVn and exp functions to create multivariate lognormally distributed random deviates. For example:
//Covariance matrix cov = { 1 0.6, 0.6 1 }; //Mean for each column mean = { 1, 1 }; //Create multivariate random normal numbers,/span> x = rndMVn(1e6, mean, cov); //normal -> lognormal x_lognorm = exp(x);
You can calculate the mean and variance like this:
//Mean for normal numbers above mean = 1; //Variance for normal numbers above variance = 1; mean_lognorm = exp(mean + variance./2); var_lognorm = (exp(variance) - 1) .* exp(2 .* mean + variance);
Based on the formulas above, the mean and variance for our example in the first code snippet should be approximately 4.48 and 34.51 (with a standard deviation of about 5.87).