Hi,
I have a result variable X that is defined by an equation of random variables.
We used prctile to see the results we get with several probabilities, but now we need to known what is the probability that X is going to be under a certain value.
Is there any function that can give this?
One way I was thinking about doing this is to count the number of samples in the simulation where X is below the mark, but I don't known how to do this neither.
Thank you very much,

 채택된 답변

Matt Tearle
Matt Tearle 2014년 11월 4일

0 개 추천

Counting the number of samples with a given criterion is easy enough:
threshhold = pi;
nnz(X < threshhold)
The ecdf (empirical CDF) function might also help.

댓글 수: 4

Alexandra
Alexandra 2014년 11월 4일
Thank you, that was great.
I tried this:
Prob = mean(bsxfun(@lt,X,threshold),1)
Is this correct? The simulation is already running. Otherwise I will just try to do what you suggested.
Matt Tearle
Matt Tearle 2014년 11월 4일
So X is a matrix, where each row is a simulation, and each column is...? Then you have a different threshold for each column? In that case, yes, what you have seems right to me -- it will give the proportion of successful trials (X value less than threshold) for each different threshold value.
Alexandra
Alexandra 2014년 11월 5일
Only one column, the X column. Each row is a simulation. I think it worked. Thank you very much.
Matt Tearle
Matt Tearle 2014년 11월 5일
For a single column bsxfun is overkill. mean(X < threshold) would do it.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

질문:

2014년 11월 4일

댓글:

2014년 11월 5일

Community Treasure Hunt

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

Start Hunting!

Translated by