Picking random numbers with some predefined probability
Show older comments
I have a variable lets say x = 3.3:8.5
I have to pick 200 random numbers from this range but there are a few conditions;
1) I have predefined probabilities of picking random numbers which is p = [0.16 0.24 0.28 0.32] for the intervals [3.3 4.6], [4.6 5.9], [5.9,7.2], and [7.2 8.5].
2) I would like to pick more number of elements from higher end of intervals, for example numbers picked from [7.2 8.5] should be closer to 8.5 than to 7.2.
I am trying to use a normal distribution with mean at 8.5 and truncating it at 3.3 and 8.5. I am playing with standard deviation to find the desired CDF plot.
I would like to know if there is any way to define a distribution by just using the information I have that is more technical than playing with standard deviation. You can find my code attached.
Also, should i include kurtosis and skewness in the definition of distribution? I am not so sure I need skewness since I am already truncating it at 8.5 which also happens to be the mean.
Thanks.
2 Comments
John D'Errico
on 4 Apr 2020
You have predefined probabilities. So then why in the name of god and little green apples are you then trying to stuff this into a normal distribution? Yes, I know. That is the only thing you know how to use. It is not even remotely close.
Instead, to choose a random number from this strange distribution,...
- Choose which interval a given point will be chosen from. That happens with the probabilities indicated in p, so that choice is just a discrete random variable from the numbers [1,2,3,4], based on p.
- Once you have chosen the interval for any given sample, now you need to decide what the probability distribution in that interval is. A simple choice might be a translated beta distribution. So sample from a beta random variable (see betarnd, from the stats toolbox) then shift and scale it to lie in the appropriate interval.
The nie thing about the choice of a beta distribution, is you have a great deal of choice in your control the shape of the pdf, based on the beta parameters.
bhuvan khoshoo
on 4 Apr 2020
Accepted Answer
More Answers (0)
Categories
Find more on Uniform Distribution (Continuous) in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
