Exact probability of a triangular distribution

How can I find exact probability of triangular distribution? Actually my exact question is: use simulation to estimate the probability that a triangular random variable is greater than its mean. You can take the parameters of the triangular random variable as follows: the minimum value as the sum of last digits of IDs of your group members, the mode value as the sum of the last two digits of of IDs of your group members and the maximum value as the sum of the last three digits of of IDs of your group members. Please, perform the simulation 1000 times and compare the estimated probability with the exact one. But I could not find the exact probabilty?
parameters = [31 56 75];
lower = min(parameters);
peak = median(parameters);
upper = max(parameters);
pd = makedist('Triangular','a',lower,'b',peak,'c',upper)
x = 0:.1:230;
y = pdf(pd,x);
plot(x,y)
title('Triangular Distribution')
xlim([0 100])
rng('default'); % For reproducibility
r = random(pd,1000,1)
sort_time = sort(time,'descend');
secondLargest = sort_time(2);
figure
pd2 = makedist('Triangular','a',lower,'b',peak,'c',secondLargest);
y2 = pdf(pd2,x);
plot(x,y2,'LineWidth',2)
title('Triangular Distribution')
xlim([0 100])
rng('default'); % For reproducibility
r2 = random(pd2,1000,1)
I transferred the random numbers I produced in Matlab to Excel.

3 件のコメント

Rik
Rik 2020 年 4 月 6 日
This sounds like homework. Is it?
Burhan Elaldi
Burhan Elaldi 2020 年 4 月 6 日
yes
Burhan Elaldi
Burhan Elaldi 2020 年 4 月 6 日
 I asked for a point where I was stuck in my homework.

サインインしてコメントする。

 採用された回答

James Tursa
James Tursa 2020 年 4 月 6 日
編集済み: James Tursa 2020 年 4 月 6 日

1 投票

The exact probability of getting a number greater than the mean is simply the sum of the probabily to the right of the mean. Since the cumulative distribution function gives the sum of the probablity to the left, you simply need to take 1-cdf evaluated at your point of interest to get your exact probability. E.g.,
>> exact_probability = 1 - cdf(pd,mean(pd))
exact_probability =
0.5191
And this seems to match a large simulation result pretty well
>> sum(random(pd,1000000,1)>mean(pd))/1000000
ans =
0.5194

3 件のコメント

Burhan Elaldi
Burhan Elaldi 2020 年 4 月 6 日
Actually, I found the probability that triangle random variable is greater than its mean (54) , from 1000 random variables that I transferred from Matlab to Excel as you see on the above. This value which I found from excel is 0.511. Now I have to compare 0.511 with the exact one.
What is the exact one? Is 0.5191 which you find?
Why did you divide by 1000000? I have to perform simulation 1000 times and I think we should divide by 1000 not 1000000.
What is the mean of 0.5194? I did not get it.
Thank you for your helping :)
James Tursa
James Tursa 2020 年 4 月 6 日
Why did you divide by 1000000?
This:
sum(random(pd,1000000,1)>mean(pd))/1000000
is a one-line simulation of a random sampling of 1000000 trials. I was just picking a big number for example.
In your case, yes you would use 1000 not 1000000.
What is the exact one?
Just as I have stated, this is the exact one:
1 - cdf(pd,mean(pd))
If you want to see more digits, then
>> format longg
>> 1 - cdf(pd,mean(pd))
ans =
0.51909090909091
Burhan Elaldi
Burhan Elaldi 2020 年 4 月 6 日
Thank you so much :)

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeRandom Number Generation についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by