Discretizing the probability distribution
Mostra commenti meno recenti
I have a probability distribution f on [0,1]. I want to discretize f on (0,0.1,0.2,...1). I see
"What you could do instead, in order to approximate it to a discrete probability space, is to define some points (x_1, x_2, ..., x_n), and let their discrete probabilities be the integral of some range of the PDF (from your continuous probability distribution), that is P(x_1) = P(X \in (-infty, x_1_end)), P(x_2) = P(X \in (x_1_end, x_2_end)), ..., P(x_n) = P(X \in (x_(n-1)_end, +infty))"
Is there any implementation of this idea?
4 Commenti
John D'Errico
il 26 Lug 2020
Not sure where the problem lies. One (short) line of code, based on the inverse CDF? Something like:
X = norminv(0.1:.1:.9);
If you lack the stats toolbox, then tools like erfinv are a direct substitute for norminv. You may need to do some reading in Abramowitz and Stegun for many of the common distributions, since a few are based on a transformation of the the gamma, and matlab provides an inverse gamma and inverse beta.
If you don't have the inverse CDF, then you could use a root finder, applied to the CDF.
If you have only the PDF, and not the CDF, then you use a rootfinder applied to a integral of the PDF.
alpedhuez
il 26 Lug 2020
John D'Errico
il 26 Lug 2020
Modificato: John D'Errico
il 26 Lug 2020
And what do you think your question asked? That is, it seems to be to find the points x1,x2,...
You don't recognize what was said there as locating the corresponding quantiles of that distribution?
If all you want to do is to find the probbilities for a fixed set of x_i, then all you need to do is compute the integral under the PDF, and this is given directly by the CDF. In any event, this is fairly easy to do.
alpedhuez
il 26 Lug 2020
Risposta accettata
Più risposte (0)
Categorie
Scopri di più su Special Functions in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!