Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 15 additions & 26 deletions causalpy/pymc_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,19 +184,16 @@ def print_row(


class LinearRegression(PyMCModel):
"""
r"""
Custom PyMC model for linear regression.

Defines the PyMC model

.. math::
\\beta &\sim \mathrm{Normal}(0, 50)

\sigma &\sim \mathrm{HalfNormal}(1)

\mu &= X * \\beta

y &\sim \mathrm{Normal}(\mu, \sigma)
\beta &\sim \mathrm{Normal}(0, 50) \\
\sigma &\sim \mathrm{HalfNormal}(1) \\
\mu &= X \cdot \beta \\
y &\sim \mathrm{Normal}(\mu, \sigma) \\

Example
--------
Expand Down Expand Up @@ -230,20 +227,16 @@ def build_model(self, X, y, coords):


class WeightedSumFitter(PyMCModel):
"""
r"""
Used for synthetic control experiments.

Defines the PyMC model:

.. math::

\sigma &\sim \mathrm{HalfNormal}(1)

\\beta &\sim \mathrm{Dirichlet}(1,...,1)

\mu &= X * \\beta

y &\sim \mathrm{Normal}(\mu, \sigma)
\sigma &\sim \mathrm{HalfNormal}(1) \\
\beta &\sim \mathrm{Dirichlet}(1,...,1) \\
\mu &= X \cdot \beta \\
y &\sim \mathrm{Normal}(\mu, \sigma) \\

Example
--------
Expand Down Expand Up @@ -423,7 +416,7 @@ def fit(self, X, Z, y, t, coords, priors, ppc_sampler=None):


class PropensityScore(PyMCModel):
"""
r"""
Custom PyMC model for inverse propensity score models

.. note:
Expand All @@ -433,14 +426,10 @@ class PropensityScore(PyMCModel):
Defines the PyMC model

.. math::
\\beta &\sim \mathrm{Normal}(0, 1)

\sigma &\sim \mathrm{HalfNormal}(1)

\mu &= X * \\beta

p &= logit^{-1}(mu)

\beta &\sim \mathrm{Normal}(0, 1) \\
\sigma &\sim \mathrm{HalfNormal}(1) \\
\mu &= X \cdot \beta \\
p &= \text{logit}^{-1}(\mu) \\
t &\sim \mathrm{Bernoulli}(p)

Example
Expand Down
Loading