9
9
NegativeBinomial ,
10
10
Normal ,
11
11
Uniform ,
12
+ ZeroInflatedPoisson ,
12
13
)
13
14
from pymc .math import dot
14
15
from pymc .model import Deterministic , Model , Potential
@@ -47,6 +48,9 @@ def setup_class(self):
47
48
# )
48
49
nb2 = NegativeBinomial ("nb_with_p_n" , p = Uniform ("nbp" ), n = 10 )
49
50
51
+ # Symbolic distribution
52
+ zip = ZeroInflatedPoisson ("zip" , 0.5 , 5 )
53
+
50
54
# Expected value of outcome
51
55
mu = Deterministic ("mu" , floatX (alpha + dot (X , b )))
52
56
@@ -76,7 +80,7 @@ def setup_class(self):
76
80
# add a potential as well
77
81
pot = Potential ("pot" , mu ** 2 )
78
82
79
- self .distributions = [alpha , sigma , mu , b , Z , nb2 , Y_obs , pot ]
83
+ self .distributions = [alpha , sigma , mu , b , Z , nb2 , zip , Y_obs , pot ]
80
84
self .deterministics_or_potentials = [mu , pot ]
81
85
# tuples of (formatting, include_params
82
86
self .formats = [("plain" , True ), ("plain" , False ), ("latex" , True ), ("latex" , False )]
@@ -88,6 +92,7 @@ def setup_class(self):
88
92
r"beta ~ N(0, 10)" ,
89
93
r"Z ~ N(f(), f())" ,
90
94
r"nb_with_p_n ~ NB(10, nbp)" ,
95
+ r"zip ~ MarginalMixtureRV{inline=False}" ,
91
96
r"Y_obs ~ N(mu, sigma)" ,
92
97
r"pot ~ Potential(f(beta, alpha))" ,
93
98
],
@@ -98,6 +103,7 @@ def setup_class(self):
98
103
r"beta ~ N" ,
99
104
r"Z ~ N" ,
100
105
r"nb_with_p_n ~ NB" ,
106
+ r"zip ~ MarginalMixtureRV{inline=False}" ,
101
107
r"Y_obs ~ N" ,
102
108
r"pot ~ Potential" ,
103
109
],
@@ -108,6 +114,7 @@ def setup_class(self):
108
114
r"$\text{beta} \sim \operatorname{N}(0,~10)$" ,
109
115
r"$\text{Z} \sim \operatorname{N}(f(),~f())$" ,
110
116
r"$\text{nb_with_p_n} \sim \operatorname{NB}(10,~\text{nbp})$" ,
117
+ r"$\text{zip} \sim \text{MarginalMixtureRV{inline=False}}$" ,
111
118
r"$\text{Y_obs} \sim \operatorname{N}(\text{mu},~\text{sigma})$" ,
112
119
r"$\text{pot} \sim \operatorname{Potential}(f(\text{beta},~\text{alpha}))$" ,
113
120
],
@@ -118,6 +125,7 @@ def setup_class(self):
118
125
r"$\text{beta} \sim \operatorname{N}$" ,
119
126
r"$\text{Z} \sim \operatorname{N}$" ,
120
127
r"$\text{nb_with_p_n} \sim \operatorname{NB}$" ,
128
+ r"$\text{zip} \sim \text{MarginalMixtureRV{inline=False}}$" ,
121
129
r"$\text{Y_obs} \sim \operatorname{N}$" ,
122
130
r"$\text{pot} \sim \operatorname{Potential}$" ,
123
131
],
0 commit comments