How to divide the interval of any distribution in N equal parts based on its area?
42 ビュー (過去 30 日間)
古いコメントを表示
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 件のコメント
採用された回答
John D'Errico
2021 年 8 月 30 日
編集済み: John D'Errico
2021 年 8 月 30 日
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
その他の回答 (1 件)
Walter Roberson
2021 年 8 月 30 日
編集済み: Walter Roberson
2021 年 8 月 30 日
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 件のコメント
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!