Sampling based on a correlation matrix for multiple parameters?

4 Ansichten (letzte 30 Tage)
Klaas
Klaas am 31 Jan. 2019
Kommentiert: Klaas am 1 Feb. 2019
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!

Akzeptierte Antwort

Jeff Miller
Jeff Miller am 31 Jan. 2019
Use mvnrnd for this.
The parameter mu is a vector of the means for your p's, i.e. mu = [1800, 900, etc].
The parameter sigma is a square covariance matrix. To compute it, start with your correlation matrix, then multiply the number in each column by the standard deviation of that column's variable, and then multiply the number in each row by the standard deviation of that row's variable. (At the end, the diagonal elements of this sigma matrix will be the variances of the individual variables.)

Weitere Antworten (0)

Kategorien

Mehr zu Descriptive Statistics finden Sie in Help Center und File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by