How to create a skewed distribution that is truncated?

13 次查看(过去 30 天)
Hello,
I am trying to make a right skewed truncated distribution with a mean of 75 and SD of 15 that does not produce values outside of 0 and 100.
I understand that you can truncate a normale distribution probability object with... t = truncate(pd,lower,upper)
Meanwhile, I know that you can also create a skewed distribution with: pearsrnd(mean,sd,skew,kurt,trials,col)
However, I am not sure how you create both a skewed distribution and extract values from it that also is truncated? Can anyone assist me with this?
  3 个评论
Jacob Elder
Jacob Elder 2019-10-15
编辑:Jacob Elder 2019-10-15
That's a fair point and good recommendation. I did as you mentioned and it worked well.
mean = 75;
sd = 5;
skew = .3;
kurt = 2.7;
col = 1
trial = 1;
rating = [];
while length(rating)<100
r = pearsrnd(mean,sd,skew,kurt,trial,col);
if r > 0 & r < 100
rating = [rating ; r];
end
end
hist(rating)
With data as:
71.8622107925150
71.1555187688770
73.3512486969151
74.4146040772961
79.5851649991042
68.3599490492784
76.4590822947942
82.1753624683229
72.0157085567081
71.3164705444270
74.8591991541973
79.4617019190464
81.0304110319437
73.3634567624738
75.4805220787830
81.2771116347441
74.8479490651980
76.6408620461409
73.7497657770307
etc.
And plot as
I need to fiddle with the skew and kurtosis but your idea helped with my issue. Thanks!
Adam Danz
Adam Danz 2019-10-15
Great! I'll copy my comment as an answer below so your question appears as solved. Note that this method biases the distribution which could result in distribution that doesn't maintain the properties of the actual desired distribution. But that's at least partial true of any bounded distribution.

请先登录,再进行评论。

采纳的回答

Adam Danz
Adam Danz 2019-10-15
(continuing from the comments under the question)
One solution is to just truncate the distribution yourself by producing the distribution, cutting out values beyond your bounds, and replacing them with a new draw of numbers from the same distribution. That process could be set up in a while-loop that ends when the number of accepted values reaches your specification. Note that this could bias your distribution as is discussed in the comments under the question.

更多回答(0 个)

Community Treasure Hunt

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

Start Hunting!

Translated by