Discretizing a continuous distribution

5 ビュー (過去 30 日間)
alpedhuez
alpedhuez 2018 年 3 月 29 日
コメント済み: Walter Roberson 2019 年 5 月 1 日
Suppose I have a continuous pdf on [0,1]. Suppose I have grid points {0,0.1,...,1}. Suppose I calculate f(0),f(0.1),...,f(1) and normalize by \sum{f(0)+....+f(1)}. Would it give an approximate discretized distribution?
  1 件のコメント
Torsten
Torsten 2018 年 3 月 29 日
What do you mean by "Discretize a continuous distribution" ?

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

回答 (2 件)

Xiaolu Zhu
Xiaolu Zhu 2018 年 12 月 29 日
Did you find the answer of how to discretize a continuous distribution?
  2 件のコメント
S.R.
S.R. 2019 年 5 月 1 日
I also would like to know if anyone knows how to discritize a continious distribution such as normal distribution or exponential distribution knowing its mean and standard deviation.
Walter Roberson
Walter Roberson 2019 年 5 月 1 日
Do you want equal spacing on the independent variable? Do you want to know where the boundaries are for equal spacing on the cdf? Do you want to divide up a range so that in each section the product of the pdf at the center point times the bin width is equal for all the bins?

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


Walter Roberson
Walter Roberson 2018 年 12 月 29 日
No, it would not.
Consider the beta distribution with alpha=2, beta=5; https://en.wikipedia.org/wiki/Beta_distribution
x = 0:.1:1;
Alpha = 2; Beta = 5; %do not use beta, we need the beta function
num = x.^(Alpha-1).*(1-x).^(Beta-1);
den = gamma(Alpha)*gamma(Beta)/gamma(Alpha+Beta);
f = num./den;
fnorm = f./sum(f);
disp(mat2str(fnorm))
syms t;
Betareg = @(x,a,b) vpaintegral(t^(a-1).*(1-t)^(b-1),t,0,x)./beta(a,b);
fcdf = double(arrayfun(@(X) Betareg(X, Alpha, Beta), x));
disp(mat2str(fcdf))
[0 0.201845869866174 0.25202276572835 0.221596677434241 0.159483156437471 0.0961390555299185 0.0472542685740655 0.0174434702353484 0.00393785571450546 0.000276880479926165 0]
[0 0.114265 0.34464 0.579825 0.76672 0.890625 0.95904 0.989065 0.9984 0.999945 1]
Notice that f rises and falls but the cdf doesn't. So you might want cumsum(f)./sum(f) which would give you
[0 0.201845869866174 0.453868635594524 0.675465313028765 0.834948469466236 0.931087524996154 0.97834179357022 0.995785263805568 0.999723119520074 1 1]
You can see that the approximation is not good at all.

タグ

製品

Community Treasure Hunt

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

Start Hunting!

Translated by