[英]How to simulate new values without normality assumption?
I have the following list:我有以下列表:
series=[0.6, 4.1, 0.6, 6.7, 9.2, 7.6, 5.5, 0.9, 3.8, 8.4]
the mean
of series
is 4.74 and its np.std
equals: 3.101 series
的mean
为 4.74,其np.std
等于:3.101
I want to generate 1000 observations from series
so I used the following method:我想从series
中生成 1000 个观察结果,所以我使用了以下方法:
>>> series_1000=np.random.normal(4.74, 3.101, size=(1000))
>>> series_1000
>>> array([ 3.43395217, 6.60462489, 5.27316166, 4.20429521, 4.76772334,
8.04441319, -0.6967243 , 0.53378519, 2.1736758 , 9.96333279....
Problem问题
The above method seems to be good, however it works under the assumption that series
is normally
distributed.上面的方法看起来不错,但是它是在series
normally
的假设下工作的。
Goal目标
My goal is to find a way of simulating values without any assumption regarding the original series
.我的目标是找到一种在不对原始series
进行任何假设的情况下模拟值的方法。
Any help from your side will be highly appreciated.您身边的任何帮助将不胜感激。
If a uniform distribution is better suited for your needs, you can use:如果统一分布更适合您的需要,您可以使用:
(np.random.uniform(-1, 1, size=1000) * 3.101) + 4.74
Or inside a convenience function:或者里面一个方便的function:
def generate_values(mean, std, size=1000):
return(np.random.uniform(-1, 1, size=size) * std) + mean
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.