Joint probability calculations w/ three variables
4 ビュー (過去 30 日間)
古いコメントを表示
Hi,
I have re-sampled three different variables simultaneously using the datasample function to create a 180x30,000 matrix of this re-sampled data. Effectively, I think of what I did in the first step as running 10,000 different simulations covering 180 months of time for three different variables since I'm dealing w/ financial data.
For each simulation I then compute the mean of each of the three variables. With some reshaping this gives me a 10,000x3 matrix where each row contains the mean of each of the three variables for a particular one of the 10,000 simulations.
With those particulars out of the way, what I'm trying to understand is how I calculate joint probabilities using this discrete simulated data. For example, how would I compute the probability of mean of X1<=10 & mean X2<=5 and mean X3<=8 using MATLAB and the 10,000x3 matrix above?
0 件のコメント
採用された回答
Prasanth Sunkara
2017 年 7 月 27 日
You can combine the condition on all the three variables together in a single expression as shown below.
Let’s say z is a matrix of size 10000x3.
Assume the three variables are stored as below.
X1 = z(1,:); X2 = z(2,:); X3 = z(3,:);
Joint Probability - P(X1<=10, X2<=5, X3<=8) can be computed as :
>> prob = nnz(z(1,:)<=10 & z(2,:)<=5 & z(3,:)<=8)/10000;
Alternatively you can use sum instead of nnz.
0 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Statistics and Machine Learning Toolbox についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!