From 646d73964805d8c76c2a0522335afeb190e5386c Mon Sep 17 00:00:00 2001 From: "Benjamin T. Vincent" Date: Tue, 17 Sep 2024 08:46:46 +0100 Subject: [PATCH 1/3] fix SyntaxWarning by making some docstrings raw --- causalpy/pymc_models.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/causalpy/pymc_models.py b/causalpy/pymc_models.py index 39d26025..06eab620 100644 --- a/causalpy/pymc_models.py +++ b/causalpy/pymc_models.py @@ -184,7 +184,7 @@ def print_row( class LinearRegression(PyMCModel): - """ + r""" Custom PyMC model for linear regression. Defines the PyMC model @@ -230,7 +230,7 @@ def build_model(self, X, y, coords): class WeightedSumFitter(PyMCModel): - """ + r""" Used for synthetic control experiments. Defines the PyMC model: @@ -423,7 +423,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: From 9f5c23a740d40b17b33cec6879d9a9883600b061 Mon Sep 17 00:00:00 2001 From: "Benjamin T. Vincent" Date: Wed, 9 Oct 2024 13:12:42 +0100 Subject: [PATCH 2/3] \\beta -> \beta --- causalpy/pymc_models.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/causalpy/pymc_models.py b/causalpy/pymc_models.py index 06eab620..bd669215 100644 --- a/causalpy/pymc_models.py +++ b/causalpy/pymc_models.py @@ -190,11 +190,11 @@ class LinearRegression(PyMCModel): Defines the PyMC model .. math:: - \\beta &\sim \mathrm{Normal}(0, 50) + \beta &\sim \mathrm{Normal}(0, 50) \sigma &\sim \mathrm{HalfNormal}(1) - \mu &= X * \\beta + \mu &= X * \beta y &\sim \mathrm{Normal}(\mu, \sigma) @@ -239,9 +239,9 @@ class WeightedSumFitter(PyMCModel): \sigma &\sim \mathrm{HalfNormal}(1) - \\beta &\sim \mathrm{Dirichlet}(1,...,1) + \beta &\sim \mathrm{Dirichlet}(1,...,1) - \mu &= X * \\beta + \mu &= X * \beta y &\sim \mathrm{Normal}(\mu, \sigma) @@ -433,11 +433,11 @@ class PropensityScore(PyMCModel): Defines the PyMC model .. math:: - \\beta &\sim \mathrm{Normal}(0, 1) + \beta &\sim \mathrm{Normal}(0, 1) \sigma &\sim \mathrm{HalfNormal}(1) - \mu &= X * \\beta + \mu &= X * \beta p &= logit^{-1}(mu) From 553cf535c8066156973b3533210f095360ab5b3f Mon Sep 17 00:00:00 2001 From: "Benjamin T. Vincent" Date: Wed, 9 Oct 2024 13:17:54 +0100 Subject: [PATCH 3/3] fix up LaTeX in docstrings --- causalpy/pymc_models.py | 35 ++++++++++++----------------------- 1 file changed, 12 insertions(+), 23 deletions(-) diff --git a/causalpy/pymc_models.py b/causalpy/pymc_models.py index bd669215..bbd93110 100644 --- a/causalpy/pymc_models.py +++ b/causalpy/pymc_models.py @@ -190,13 +190,10 @@ class LinearRegression(PyMCModel): 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 -------- @@ -236,14 +233,10 @@ class WeightedSumFitter(PyMCModel): 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 -------- @@ -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