Joint probability calculations w/ three variables

5 ビュー (過去 30 日間)
Jared
Jared 2017 年 7 月 23 日
回答済み: Prasanth Sunkara 2017 年 7 月 27 日
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?

採用された回答

Prasanth Sunkara
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 件)

カテゴリ

Help Center および File ExchangeAssembly についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by