Sampling based on a correlation matrix for multiple parameters?
Show older comments
Dear all,
I would like to sample 5 parameters (p1-->5) which all have a normal distributon (mu and SD are know). In addition I would like that my sampling follows a given correlation matrix between the parameters.Can anyone help my out to find which command is able to do this as I'm confused by all the statistical info in the help files?
I've read that it's best to first randomly sample the data based on the distributions and then use the correlation matrix to rank them so that they follow the Pearson correlation matrix.
clear
n = 1000;
p1=normrnd(1800,100,[1,n]);
p2=normrnd(900,60,[1,n]);
p3=normrnd(0.6,0.15,[1,n]);
p4=normrnd(10,5,[1,n]);
p5=normrnd(0.3,0.05,[1,n]);
Correlation=[1 -0.5 0.95 0.7 -0.9;-0.5 1 -0.1 -0.3 -0.4;0.95 -0.1 1 0.7 0.55;0.7 -0.3 0.7 1 -0.6;-0.9 0.4 0.85 -0.6 1];
I tried to use copulas but I don't suceed to make it work for the 5 parameters at once instead of 2 parameters in the examples.
Many thanks in advance!
Accepted Answer
More Answers (0)
Categories
Find more on Copula Distributions and Correlated Samples in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!