本文介绍了“反向"指的是“反向".统计:根据均值和标准差生成数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

拥有数据集并从中计算统计数据很容易.反过来呢?

Having a dataset and calculating statistics from it is easy. How about the other way around?

比方说,我知道某个变量的平均值为X,标准差为Y,并假定其具有正态(高斯)分布.生成适合分布的随机"数据集(任意大小)的最佳方法是什么?

Let's say I know some variable has an average X, standard deviation Y and assume it has normal (Gaussian) distribution. What would be the best way to generate a "random" dataset (of arbitrary size) which will fit the distribution?

这种发展源自此问题;我可以根据这种方法做一些事情,但是我想知道是否有一种更有效的方法.

This kind of develops from this question; I could make something based on that method, but I am wondering if there's a more efficient way to do it.

推荐答案

您可以使用 Box-Mueller方法.然后将其转换为具有均值mu和标准偏差sigma的方法,将您的样本乘以sigma并加mu.IE.对于标准法线中的每个z,返回mu + sigma * z.

You can generate standard normal random variables with the Box-Mueller method. Then to transform that to have mean mu and standard deviation sigma, multiply your samples by sigma and add mu. I.e. for each z from the standard normal, return mu + sigma*z.

这篇关于“反向"指的是“反向".统计:根据均值和标准差生成数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-22 07:14