简体   繁体   中英

Numpy's Multivariate Normal example is not clear

I am not sure if this question fits to numpy users or mathematicians. I don't understand how the numpy.random.multivariate_normal example works.

In the bottom of the documentation, it generates a few random values given a mean and covariance matrix,

mean = (1, 2)
cov = [[1, 0], [0, 1]]
x = np.random.multivariate_normal(mean, cov, (3, 3))

and then says:

The following is probably true, given that 0.6 is roughly twice the standard deviation.

I understand that this is coming from the empirical rule but I don't know how the standard deviation is 0.3.

Can anyone help me through this?

The sentence you refer to, refers to the property of a normal distribution in general ( enter link description here ),

在此处输入图像描述

and not to some NumPy -specific functionality. As you normalize the samples you ger, ie, reduce the mean, the distribution is shifted around 0 , and given that the std of the samples is 0.3 , than most of the samples will be generated in range which is less than 3*0.3 = 0.9 from the mean, viz. 0, with the following proportion:

  • ~68.27% in range [-0.3, +0.3]
  • ~95.45% in range of [-0.6, +0.6]
  • ~99.73% in range of [-0.9, +0.9]

so, it follows that roughly 95% of the times the X you get in the vector you produce will be smaller than 0.6, if the std=0.3 .

Cheers

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM