@@ -2705,55 +2705,55 @@ class ZeroSumNormal(Distribution):
27052705
27062706 .. math::
27072707
2708- \begin{align*}
2709- ZSN(\sigma) = N \Big( 0, \sigma^2 (I_K - \tfrac{1}{K}J_K) \Big) \\
2710- \text{where} \ ~ J_{ij} = 1 \ ~ \text{and} \\
2711- K = \text{size (length) of the constrained axis}
2712- \end{align*}
2708+ \begin{align*}
2709+ ZSN(\sigma) = N \Big( 0, \sigma^2 (I_K - \tfrac{1}{K}J_K) \Big) \\
2710+ \text{where} \ ~ J_{ij} = 1 \ ~ \text{and} \\
2711+ K = \text{size (length) of the constrained axis}
2712+ \end{align*}
27132713
27142714 Parameters
27152715 ----------
27162716 sigma : tensor_like of float
2717- Scale parameter (sigma > 0).
2718- It's actually the standard deviation of the underlying, unconstrained Normal distribution.
2719- Defaults to 1 if not specified. ``sigma`` cannot have length > 1 across the zero-sum axes.
2717+ Scale parameter (sigma > 0).
2718+ It's actually the standard deviation of the underlying, unconstrained Normal distribution.
2719+ Defaults to 1 if not specified. ``sigma`` cannot have length > 1 across the zero-sum axes.
27202720 n_zerosum_axes: int, defaults to 1
2721- Number of axes along which the zero-sum constraint is enforced, starting from the rightmost position.
2722- Defaults to 1, i.e the rightmost axis.
2721+ Number of axes along which the zero-sum constraint is enforced, starting from the rightmost position.
2722+ Defaults to 1, i.e the rightmost axis.
27232723 dims: sequence of strings, optional
2724- Dimension names of the distribution. Works the same as for other PyMC distributions.
2725- Necessary if ``shape`` is not passed.
2724+ Dimension names of the distribution. Works the same as for other PyMC distributions.
2725+ Necessary if ``shape`` is not passed.
27262726 shape: tuple of integers, optional
2727- Shape of the distribution. Works the same as for other PyMC distributions.
2728- Necessary if ``dims`` or ``observed`` is not passed.
2727+ Shape of the distribution. Works the same as for other PyMC distributions.
2728+ Necessary if ``dims`` or ``observed`` is not passed.
27292729
27302730 Warnings
27312731 --------
2732- Currently, ``sigma`` cannot have length > 1 across the zero-sum axes to ensure the zero-sum constraint.
2732+ Currently, ``sigma``cannot have length > 1 across the zero-sum axes to ensure the zero-sum constraint.
27332733
27342734 ``n_zerosum_axes`` has to be > 0. If you want the behavior of ``n_zerosum_axes = 0``,
27352735 just use ``pm.Normal``.
27362736
27372737 Examples
27382738 --------
27392739 Define a `ZeroSumNormal` variable, with `sigma=1` and
2740- `n_zerosum_axes=1` by default::
2741-
2742- COORDS = {
2743- "regions": ["a", "b", "c"],
2744- "answers": ["yes", "no", "whatever", "don't understand question"],
2745- }
2746- with pm.Model(coords=COORDS) as m:
2747- # the zero sum axis will be 'answers'
2748- v = pm.ZeroSumNormal("v", dims=("regions", "answers"))
2749-
2750- with pm.Model(coords=COORDS) as m:
2751- # the zero sum axes will be 'answers' and 'regions'
2752- v = pm.ZeroSumNormal("v", dims=("regions", "answers"), n_zerosum_axes=2)
2753-
2754- with pm.Model(coords=COORDS) as m:
2755- # the zero sum axes will be the last two
2756- v = pm.ZeroSumNormal("v", shape=(3, 4, 5), n_zerosum_axes=2)
2740+ `n_zerosum_axes=1` by default::
2741+
2742+ COORDS = {
2743+ "regions": ["a", "b", "c"],
2744+ "answers": ["yes", "no", "whatever", "don't understand question"],
2745+ }
2746+ with pm.Model(coords=COORDS) as m:
2747+ # the zero sum axis will be 'answers'
2748+ v = pm.ZeroSumNormal("v", dims=("regions", "answers"))
2749+
2750+ with pm.Model(coords=COORDS) as m:
2751+ # the zero sum axes will be 'answers' and 'regions'
2752+ v = pm.ZeroSumNormal("v", dims=("regions", "answers"), n_zerosum_axes=2)
2753+
2754+ with pm.Model(coords=COORDS) as m:
2755+ # the zero sum axes will be the last two
2756+ v = pm.ZeroSumNormal("v", shape=(3, 4, 5), n_zerosum_axes=2)
27572757 """
27582758
27592759 rv_type = ZeroSumNormalRV
0 commit comments