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