当前位置: 首页>>代码示例 >>用法及示例精选 >>正文


Python Sympy stats.GeneralizedMultivariateLogGammaOmega()用法及代码示例


借助sympy.stats.GeneralizedMultivariateLogGammaOmega()方法,我们可以获得连续的关节随机变量,该变量表示扩展的广义多元对数伽马分布。

用法: GeneralizedMultivariateLogGammaOmega(syms, omega, v, lamda, mu)
参数:
1) Syms - list of symbols
2) Omega - a square matrix
3) V - positive real number
4) Lambda - a list of positive reals
5) mu - a list of positive real numbers.
返回:Return the continuous joint random variable.

范例1:
在这个例子中,我们可以通过使用sympy.stats.GeneralizedMultivariateLogGammaOmega()该方法可以得到代表扩展广义广义对数伽马分布的连续联合随机变量。

# Import sympy and GeneralizedMultivariateLogGammaOmega 
from sympy.stats import density 
from sympy.stats.joint_rv_types import GeneralizedMultivariateLogGammaOmega 
from sympy.stats.joint_rv import marginal_distribution 
from sympy import symbols, S, Matrix 
  
v = 1
l, mu = [1, 1, 1], [1, 1, 1] 
d = S.One 
y = symbols('y_1:4', positive = True) 
omega = Matrix([[1, S.Half, S.Half], [S.Half, 1, S.Half], [S.Half, S.Half, 1]]) 
  
# Using sympy.stats.GeneralizedMultivariateLogGammaOmega() method 
Gd = GeneralizedMultivariateLogGammaOmega('G', omega, v, l, mu) 
gfg = density(Gd)(y[0], y[1], y[2]) 
  
pprint(gfg)

输出:

         oo                                                               
      ______                                                              
      \     `                                                             
       \                 n                                                
        \     /      ___\                                y_1    y_2    y_3
         \    |    \/ 2 |   (n + 1)*(y_1 + y_2 + y_3) - e    - e    - e   
  ___     \   |1 - -----| *e                                              
\/ 2 *    /   \      2  /                                                 
         /    ------------------------------------------------------------
        /                                 3                               
       /                             Gamma (n + 1)                        
      /_____,                                                             
       n = 0                                                              
--------------------------------------------------------------------------
                                    2                                     

范例2:

# Import sympy and GeneralizedMultivariateLogGammaOmega 
from sympy.stats import density 
from sympy.stats.joint_rv_types import GeneralizedMultivariateLogGammaOmega 
from sympy.stats.joint_rv import marginal_distribution 
from sympy import symbols, S, Matrix 
  
v = 1
l, mu = [1, 2], [2, 1] 
d = S.One 
y = symbols('y_1:3', positive = True) 
omega = Matrix([[1, S.Half], [S.Half, 1]]) 
  
# Using sympy.stats.GeneralizedMultivariateLogGammaOmega() method 
Gd = GeneralizedMultivariateLogGammaOmega('G', omega, v, l, mu) 
gfg = density(Gd)(y[0], y[1]) 
  
pprint(gfg)

输出:

     oo                                                       
  ______                                                      
  \     `                                                     
   \                                                       y_2
    \                                             2*y_1   e   
     \                   (n + 1)*(2*y_1 + y_2) - e      - ----
      \      -n - 1  -n                                    2  
3*    /   2*2      *4  *e                                     
     /    ----------------------------------------------------
    /                             2                           
   /                         Gamma (n + 1)                    
  /_____,                                                     
   n = 0                                                      
--------------------------------------------------------------
                              4                               




注:本文由纯净天空筛选整理自 Sympy stats.GeneralizedMultivariateLogGammaOmega() in python。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。