Python中的 Sympy stats.GeneralizedMultivariateLogGamma()
借助sympy.stats.GeneralizedMultivariateLogGamma()
方法,我们可以得到表示广义多元对数伽玛分布的连续联合随机变量。
Syntax : GeneralizedMultivariateLogGamma(syms, delta, v, lamda, mu)
Parameters :
1) Syms – list of symbols
2) Delta – a constant in range [0, 1]
3) V – positive real number
4) Lambda – a list of positive reals
5) mu – a list of positive real numbers.
Return : Return the continuous joint random variable.
示例 #1:
在这个例子中我们可以看到,通过使用sympy.stats.GeneralizedMultivariateLogGamma()
方法,我们可以通过这个方法得到表示广义多元对数伽玛分布的连续联合随机变量。
# Import sympy and GeneralizedMultivariateLogGamma
from sympy.stats import density
from sympy.stats.joint_rv_types import GeneralizedMultivariateLogGamma
from sympy.stats.joint_rv import marginal_distribution
from sympy import symbols, S
v = 1
l, mu = [1, 1, 1], [1, 1, 1]
d = S.Half
y = symbols('y_1:4', positive = True)
# Using sympy.stats.GeneralizedMultivariateLogGamma() method
Gd = GeneralizedMultivariateLogGamma('G', d, v, l, mu)
gfg = density(Gd)(y[0], y[1], y[2])
pprint(gfg)
输出 :
oo
_____
\ `
\ y_1 y_2 y_3
\ -n (n + 1)*(y_1 + y_2 + y_3) - e - e - e
\ 2 *e
/ ---------------------------------------------------
/ 3
/ Gamma (n + 1)
/____,
n = 0
----------------------------------------------------------
2
示例 #2:
# Import sympy and GeneralizedMultivariateLogGamma
from sympy.stats import density
from sympy.stats.joint_rv_types import GeneralizedMultivariateLogGamma
from sympy.stats.joint_rv import marginal_distribution
from sympy import symbols, S
v = 1
l, mu = [1, 2, 3], [2, 5, 1]
d = S.One
y = symbols('y_1:4', positive = True)
# Using sympy.stats.GeneralizedMultivariateLogGamma() method
Gd = GeneralizedMultivariateLogGamma('G', d, v, l, mu)
gfg = density(Gd)(y[0], y[1], y[2])
pprint(gfg)
输出 :
oo
______
\ `
\ 5*y_2 y_3
\ 2*y_1 e e
\ (n + 1)*(2*y_1 + 5*y_2 + y_3) - e - ------ - ----
\ n -n - 1 2 3
/ 10*0 *6 *e
/ ---------------------------------------------------------------------
/ 3
/ Gamma (n + 1)
/_____,
n = 0