フィルターのクリア

Drawing from Various Truncated Normal Distributions

4 ビュー (過去 30 日間)
Colin Lynch
Colin Lynch 2018 年 5 月 25 日
コメント済み: Jeff Miller 2018 年 5 月 26 日
Hello there!
I am running several simulations where I need to randomly draw from various kinds of truncated normal distributions. The PDFs of these distributions are shown in the attached file various_truncated_distributions.png. Ideally, when I draw from these distributions, the resulting data will mirror these PDFs. However, when I do this, I get a weird bimodal distribution, as shown in random_draw_test.png which shows the case where mu = 0. The code I used to create this graph is as follows:
pd = makedist('Normal', 'mu', 0,'sigma',.1);
t = truncate(pd,0,1);
x = 0:.01:1;
for i=1:10000
random_number(i) = random(t);
end
[histFreq, histXout] = hist(random_number, 70);
figure;
hold on
bar(histXout, histFreq/sum(histFreq)*100);
plot(x,pdf(t,x),'Color','blue','LineWidth',2);
legend({'Random Draw', 'PDF of Truncated Normal Dist'})
title('Test of Random Draw')
xlabel('Task-Associated Stimulus')
ylabel('Percent')
Am I drawing from this distribution incorrectly, or do I fundamentally misunderstand what it is that I am attempting to do and something like the central limit theorem is skewing my results?
Sincerely, Colin
  1 件のコメント
Jeff Miller
Jeff Miller 2018 年 5 月 26 日
I cannot replicate your bimodal figure. When I run the code you posted, the histogram looks just like the half-normal density that is plotted.
I wonder if you forgot to clear your random_number array and the upper mode (around .5) was left over from a previous random sample with a different truncated distribution.

サインインしてコメントする。

回答 (0 件)

Community Treasure Hunt

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

Start Hunting!

Translated by