Multivariate Normal CDF in Python using scipy

前端 未结 3 842
不思量自难忘°
不思量自难忘° 2020-12-06 01:36

In order to calculate the CDF of a multivariate normal, I followed this example (for the univariate case) but cannot interpret the output produced by scipy:

         


        
3条回答
  •  眼角桃花
    2020-12-06 02:05

    The scipy multivariate_normal from v1.1.0 has a cdf function built in now:

    from scipy.stats import multivariate_normal as mvn
    import numpy as np
    
    mean = np.array([1,5])
    covariance = np.array([[1, 0.3],[0.3, 1]])
    dist = mvn(mean=mean, cov=covariance)
    print("CDF:", dist.cdf(np.array([2,4])))
    
    CDF: 0.14833820905742245
    

    Documentation for v1.4.1 can be found here.

提交回复
热议问题