Discretizing a continuous distribution

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 Commento

What do you mean by "Discretize a continuous distribution" ?

Accedi per commentare.

Risposte (2)

Xiaolu Zhu
Xiaolu Zhu il 29 Dic 2018
Did you find the answer of how to discretize a continuous distribution?

2 Commenti

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.
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?

Accedi per commentare.

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.

Prodotti

Richiesto:

il 29 Mar 2018

Community Treasure Hunt

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

Start Hunting!

Translated by