Skip to content

Commit d17412b

Browse files
committed
added sd param to normal
1 parent c198620 commit d17412b

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

pymc/distributions/continuous.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ def logp(value):
6868
return locals()
6969

7070
@tensordist(continuous)
71-
def Normal(mu=0.0, tau=1.0):
71+
def Normal(mu=0.0, tau=None, sd=None):
7272
"""
7373
Normal log-likelihood.
7474
@@ -82,13 +82,24 @@ def Normal(mu=0.0, tau=1.0):
8282
tau : float
8383
Precision of the distribution, which corresponds to
8484
:math:`1/\sigma^2` (tau > 0).
85+
sd : float
86+
Standard deviation of the distribution. Alternative parameterization.
8587
8688
.. note::
8789
- :math:`E(X) = \mu`
8890
- :math:`Var(X) = 1/\tau`
8991
9092
"""
9193

94+
if tau is None :
95+
if sd is None:
96+
tau = 1.
97+
else:
98+
tau = sd**-2
99+
else:
100+
if sd is not None:
101+
raise ValueError("Can't pass both tau and sd")
102+
92103
def logp(value):
93104

94105
return bound(

0 commit comments

Comments
 (0)