フィルターのクリア

cdf of a generated random variable is not summing to 1, any reason?

24 ビュー (過去 30 日間)
POKU GYASI
POKU GYASI 2021 年 11 月 3 日
回答済み: POKU GYASI 2022 年 4 月 20 日
please i have generated a uniform random variable
y = 5 + (8-5).*rand(3600,1)
. i run the cdf of the generated data using the code
pd = fitdist(y1,'Normal');
y1 = sort(y)
yy = pdf(pd,y1);
cy = cdf(pd,y1);
plot(y1,cy)
but the plot shows that the sum is not equal to 1. please can someone help me find the reason? and how to solve this problem?

採用された回答

Walter Roberson
Walter Roberson 2021 年 11 月 3 日
You are fitting a finite uniform random distribution as-if it were a Normal distribution -- which is an infinite distribution.
Then you expect the cumulative distribution over the finite sample to be exactly equal to 1.
But we know that cdf from -infinity to +infinity is 1 for Normal distribution, and in the best possible case, if the uniform random values just happened to look normal over the interval, we would expect that the cdf for the interval would be equal to the cdf from -infinity to the upper bound, minus the cdf from -infinity to the lower bound. The only time the result could be 1 would be if the upper bound of the interval was +infinity and the lower bound was -infinity... but your upper bound is 8 and your lower bound is 5.
You should not expect cdf of 1 for this situation.
  1 件のコメント
Walter Roberson
Walter Roberson 2021 年 11 月 3 日
y = 5 + (8-5).*rand(3600,1);
y1 = sort(y);
pd = fitdist(y,'Normal')
pd =
NormalDistribution Normal distribution mu = 6.50521 [6.47714, 6.53328] sigma = 0.858968 [0.839576, 0.879283]
yy = pdf(pd,y1);
cy = cdf(pd,y1);
plot(y1,cy)
cy(end) - cy(1)
ans = 0.9191
cdf(pd, 8) - cdf(pd, 5)
ans = 0.9192

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

その他の回答 (1 件)

POKU GYASI
POKU GYASI 2022 年 4 月 20 日

Thanks Walter. You explanation is very helpful

Community Treasure Hunt

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

Start Hunting!

Translated by