【发布时间】:2018-08-08 19:25:00
【问题描述】:
所以我有一组数据,我想生成另一组相同大小的数据,其集合均值是正态分布的,与我已有的数据相关。
我查看了 stats.multivariate_normal 和 cholesky 分解,但它生成了两组(或更多)数据。有没有办法根据 Python 中已经存在的东西只生成一组数据?
# 100 random samples
x = stats.norm.rvs(loc=0, scale=1, size=100)
# What we got
n = 100
std_x = x.std()
mean_x = 0
mean_y = 1
# What I need
std_y = ?
# Means of x and what we want for y
mean_xy = [0, 1]
#Desired correlation matrix
r= [[1,0.83], [0.83,1]]
# How do I generate 100 random samples of y with a normal distribution with a mean 1 that has a 0.83 correlation with x?
感谢您的帮助!!!!
【问题讨论】:
标签: python-3.x scipy statistics