Joint probability calculations w/ three variables
4 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Jared
am 23 Jul. 2017
Beantwortet: Prasanth Sunkara
am 27 Jul. 2017
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 Kommentare
Akzeptierte Antwort
Prasanth Sunkara
am 27 Jul. 2017
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 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Statistics and Machine Learning Toolbox 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!