Joint probability calculations w/ three variables
3 次查看(过去 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 中查找有关 Assembly 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!