计算简单的具有不同均值和标准差的伪高斯分布?

发布于 2024-09-01 03:45:09 字数 408 浏览 14 评论 0 原文

这张来自维基百科的图片有一个很好的例子,说明了我理想中想要生成的函数类型:

“伪高斯分布”

现在我正在使用 Irwin-Hall 分布,它或多或少是高斯分布的多项式近似...基本上,您使用均匀随机数生成器并迭代它 x 次,然后取平均数。迭代次数越多,它就越像高斯分布。

相当不错;但是我希望能够有一个可以改变平均值的方法。例如,假设我想要一个介于 0 到 10 之间的数字,但大约 7。例如,平均值(如果我多次重复此函数)将是 7,但实际值范围是 0-10。

有没有我应该查找的,或者我应该用标准高斯分布做一些奇特的数学?

This picture from Wikipedia has a nice example of the sort of functions I'd ideally like to generate:

pseudo-Gaussian distributions

Right now I'm using the Irwin-Hall Distribution, which is more or less a polynomial approximation of the Gaussian distribution...basically, you use uniform random number generator and iterate it x times, and take the average. The more iterations, the more like a Gaussian Distribution it is.

It's pretty nice; however I'd like to be able to have one where I can vary the mean. For example, let's say I wanted a number between the range 0 and 10, but around 7. Like, the mean (if I repeated this function multiple times) would turn out to be 7, but the actual range is 0-10.

Is there one I should look up, or should I work on doing some fancy maths with standard Gaussian distributions?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

度的依靠╰つ 2024-09-08 03:45:09

我发现你的问题有矛盾。从一侧来看,您希望正态分布本质上是对称,从另一侧来看,您希望范围不对称地设置为平均值。

我怀疑您应该尝试查看其他分布密度函数,其类似于钟形曲线但不对称。就像日志分布测试版发行版

I see a contradiction in your question. From one side you want normal distribution which is symmetrical by it's nature, from other side you want the range asymmetrically disposed to mean value.

I suspect you should try to look at other distributions density functions of which are like bell curve but asymmetrical. Like log distribution or beta distribution.

蔚蓝源自深海 2024-09-08 03:45:09

查看生成正态随机变量。您可以生成正态随机变量对 X = N(0,1) 并将其转换为任何正态随机变量 Y = N(m,s) (Y = m + s*X)。

Look into generating normal random variates. You can generate pairs of normal random variates X = N(0,1) and tranform it into ANY normal random variate Y = N(m,s) (Y = m + s*X).

神也荒唐 2024-09-08 03:45:09

听起来截断正态分布正是医生所要求的。它本身并不“计算简单”,但如果您有正态分布的现有实现,则很容易实现。

您可以根据需要的均值、标准差以及任意两端生成分布。您必须事先做一些工作来计算基础(未截断)正态分布的平均值和标准差,以获得所需的 TN 平均值,但您可以使用该文章中的公式。另请注意,您也可以使用此方法调整方差:)

我有两个 准确(较慢)快速(不太准确) 实现此分布,具有 PDF、CDF 和采样。

Sounds like the Truncated Normal distribution is just what the doctor ordered. It is not "computationally simple" per se, but easy to implement if you have an existing implementation of a normal distribution.

You can just generate the distribution with the mean you want, standard deviation you want, and the two ends wherever you want. You'll have to do some work beforehand to compute the mean and standard deviation of the underlying (non-truncated) normal distribution to get the mean for the TN that you want, but you can use the formulae in that article. Also note that you can adjust the variance as well using this method :)

I have Java code (based on the Commons Math framework) for both an accurate (slower) and quick (less accurate) implementation of this distribution, with PDF, CDF, and sampling.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文