Create a matrix with a specific correlation within a specific distribution
1 回表示 (過去 30 日間)
古いコメントを表示
I am creating matrices of random variables within the normal, uniform, and chi square distributions. However, I need to be able to specify the correlation value of the matrices.
rowsize = 10;
columnsize = 3;
dg = 2;
correlation_value = 0.7;
matrix = zeros(rowsize, columnsize);
for row = 1:rowsize
for column = 1:columnsize
matrix(row, column) = chi2rnd(dg);
end
end
correlatedMatrix = SomeFunction(matrix, correlation_value);
result = corr(correlatedMatrix)
result =
1.0000 0.7000 0.7000
0.7000 1.0000 0.7000
0.7000 0.7000 1.0000
Is there a function or some code to replace
correlatedMatrix = SomeFunction(...)
or a function or code to replace the call to chi2rnd(dg) where result will still be within the chi square distribution?
0 件のコメント
回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Creating and Concatenating Matrices についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!