Clear Filters
Clear Filters

Creating Distribution by Specifying Densities

1 view (last 30 days)
Chun Hei Chan
Chun Hei Chan on 27 Apr 2023
Edited: Torsten on 27 Apr 2023
Hi,
I would like to fit a distribution to a vector that contains the probability mass/densities of the desired distribution.
For example, assume my vector of probability masses is [0.02 0.1 0.015] with the corresponding x-coordinates being [-1 0 1.2].
(So I have a probability mass of 0.02 at x = -1, a probability mass of 0.1 at x = 0 and so on).
Is there any function in MATLAB that would allow me to fit say, a normal distribution to a distribution with the probability masses at the specified coordinates? I understand that options such as fitdist are available if I am dealing with a histogram/dataset but here I would like to fit a distribution given the probability masses/densities at certain points.
Any help would be much appreciated and thank you in advance.

Answers (1)

Torsten
Torsten on 27 Apr 2023
Edited: Torsten on 27 Apr 2023
If the masses add to 1, your x-coordinates together with the probability masses already define the distribution. There is no reason for fitting here.
If the masses don't add to 1, you can arbitrarily distribute (1-sum of masses) on the x-axis. So there is not senseful way of fitting and obtaining a distribution in this case.
  2 Comments
Chun Hei Chan
Chun Hei Chan on 27 Apr 2023
Hi Torsten,
Thanks for your answer. Indeed I have a very long row vector whose entries sum up to 1 so I do know the exact quantities of the distribution of interest. The reason I am asking this question is because I want to know how well this distribution can be approximated by common distributions (e.g Normal). I want to know if there is any way of fitting a distribution as I have specified in my answer as to achieve this.
Thanks again for your help.
Torsten
Torsten on 27 Apr 2023
Edited: Torsten on 27 Apr 2023
Then I suggest you generate samples from your discrete distribution and use fitdist to fit another distribution (e.g. a normal distribution) to this sample vector.

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!