How to divide the interval of any distribution in N equal parts based on its area?
50 views (last 30 days)
Show older comments
Can anyone please help me with this
How to divide a normal distribution or log normal distribtuion with mean and standard deviation into N equal intervals
X2: Normally dist. with mean = 0.6, standard deviation= 0.1
Let us suppose I have to divide X2 into 4 (N=4) equal parts. The interval will be as follows
Interval of X2 : (-∞,0.533) (0.533,0.6) (0.6,0.667) (0.667, ∞).
So how could I do this in matlab ?
0 Comments
Accepted Answer
John D'Errico
on 30 Aug 2021
Edited: John D'Errico
on 30 Aug 2021
As long as you have the cumulative distribution, and most importantly, an inverse for the cumulative, this is all you need. For example, suppose you want to find the points where you can divide that area into 3 equal parts, given a normal distribution.
Here, I'll use a normal distribution with mean 3, and variance 4, so standard deviation 2. I want three equal parts, so the break points in the area will be:
areabreaks = linspace(0,1,4)
There must always be one extra break point. Now, we can ignore the first and last such point, because they must live at -inf and +inf.
Now, use the inverse cumulative distribution, for a normal with those parameters. If you don't know how to use norminv, then READ THE HELP.
help norminv
Now, we want to find the corresponding points where the cumulative area is 1/3 and 2/3, in our case, because I chose 3 area segments. In fact, norminv is smart enough to know that 0 maps to -inf, and 1 maps to +inf.
mu = 3;
sigma = 2;
z = norminv(areabreaks,mu,sigma)
intervals = [z(1:end-1);z(2:end)]
Nothing difficult. And only a couple of lines of code. The same will apply to your problem. TRY IT!
What is the corresponding inverse cumulative distribution function for a lognormal?
help logninv
More Answers (1)
Walter Roberson
on 30 Aug 2021
Edited: Walter Roberson
on 30 Aug 2021
If you have the Statistics and Machine Learning Toolbox, and the distribution can be specified with makedist(), then you can use icdf() asking for (1:N)/N probabilities
0 Comments
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!