Skip to content

Commit f070e88

Browse files
committed
example breakout for partial censor + trunc strategies
1 parent 578808b commit f070e88

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

pymc/distributions/censored.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,14 +101,20 @@ class Censored(Distribution):
101101
102102
Examples
103103
--------
104+
Censoring with upper & lower points set to +/-1
104105
.. code-block:: python
105106
106107
with pm.Model():
107108
normal_dist = pm.Normal.dist(mu=0.0, sigma=1.0)
108109
censored_normal = pm.Censored("censored_normal", normal_dist, lower=-1, upper=1)
110+
111+
Partial censoring of normal distributions achienved by passing +/-inf censor points.
112+
Examples of 4 censor conditions: uncensored (-inf, inf), upper censored (-inf, 1),
113+
lower censored (-1, inf), and both censored (-1, 1)
114+
.. code-block:: python
109115
with pm.Model():
110116
normal_dist = pm.Normal.dist(mu=0.0, sigma=1.0)
111-
partially_censored_normal = pm.Censored("partially_censored_normal", normal_dist, lower=-1, upper=np.inf)
117+
partially_censored_normals = pm.Censored("partially_censored_normals", normal_dist, lower=[-np.inf, -np.inf, -1, -1], upper=[np.inf, 1, np.inf, 1], shape=(4,))
112118
"""
113119

114120
rv_type = CensoredRV

pymc/distributions/truncated.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,14 +285,20 @@ class Truncated(Distribution):
285285
286286
Examples
287287
--------
288+
Truncation with upper & lower points set to +/-1
288289
.. code-block:: python
289290
290291
with pm.Model():
291292
normal_dist = pm.Normal.dist(mu=0.0, sigma=1.0)
292293
truncated_normal = pm.Truncated("truncated_normal", normal_dist, lower=-1, upper=1)
294+
295+
Partial truncatin of normal distributions achieved by passing +/-inf truncation points.
296+
Examples of 4 truncation conditions: untruncated (-inf, inf), upper truncated (-inf, 1),
297+
lower truncated (-1, inf), and both truncated (-1, 1)
298+
.. code-block:: python
293299
with pm.Model():
294300
normal_dist = pm.Normal.dist(mu=0.0, sigma=1.0)
295-
partially_truncated_normal = pm.Truncated("partially_truncated_normal", normal_dist, lower=-np.inf, upper=1)
301+
partially_truncated_normal = pm.Truncated("partially_truncated_normal", normal_dist, lower=[-np.inf, -np.inf, -1, -1], upper=[np.inf, 1, np.inf, 1], shape=(4,))
296302
"""
297303

298304
rv_type = TruncatedRV

0 commit comments

Comments
 (0)