# generating correlated random variables

17 ビュー (過去 30 日間)
Pooneh Shah Malekpoor 2021 年 5 月 10 日
コメント済み: Jeff Miller 2021 年 6 月 6 日
Hello
Though the subject might seem similar to other subjects available in this forum, it is indeed different. I am doing a Monte Carlo simulation. In each iteration, i have to consider the spatial variability of a parameter(e.g. C) along a curve. in fact, in each iteration the curve is divided to some segments and the random variables (C1,C2, C3, ...,C8) are assigned to each of these segments. Each of these C1, C2, ..,C7 have a lognormal distribution with the same parameters and there is only correlation between C7 and C8 with a correlation matrix like
rho = [ 1,0,0,0,0,0,0,0;
0,1,0,0,0,0,0,0;
0,0,1,0,0,0,0,0;
0,0,0,1,0,0,0,0;
0,0,0,0,1,0,0,0;
0,0,0,0,0,1,0,0;
0,0,0,0,0,0,1,0.2;
0,0,0,0,0,0,0.2,1]
How can i model such a process?
it is worthy to point that, there may be different numbers of random variables in other iterations of Monte carlo simulation (i.e. due to a different curve length) but they all have a lognormal distribution with the same parameters.
Any help/idea/recommendation is highly appreciated.
Best Regards

サインインしてコメントする。

### 採用された回答

Jeff Miller 2021 年 5 月 11 日
Generate C1-C6 separately (independently) from whatever lognormal you want.
Then generate C7-C8 as a pair with the desired correlation. One easy way to do that is to first generate c7,c8 with mvnrnd and then form C7=exp(c7) and C8 = exp(c8). You just have to adjust the mu & sigma parameters of mvnrnd to get the desired distribution and correlation for C7 & C8,
##### 5 件のコメント表示非表示 4 件の古いコメント
Jeff Miller 2021 年 6 月 6 日
I am not familiar with that relationship/equation but it is fine if it gives you the correlation you want between C7 and C8.

サインインしてコメントする。

### Community Treasure Hunt

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

Start Hunting!

Translated by