Skip to content

Commit 7375aa5

Browse files
committed
updating notebook
Signed-off-by: Nathaniel <[email protected]>
1 parent fd1bfb7 commit 7375aa5

File tree

2 files changed

+1070
-399
lines changed

2 files changed

+1070
-399
lines changed

causalpy/pymc_models.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -923,6 +923,7 @@ def fit_outcome_model(
923923
normal_outcome: bool = True,
924924
spline_component: bool = False,
925925
winsorize_boundary: float = 0.0,
926+
spline_knots: int = 30,
926927
) -> tuple[az.InferenceData, pm.Model]:
927928
"""
928929
Fit a Bayesian outcome model using covariates and previously estimated propensity scores.
@@ -963,6 +964,9 @@ def fit_outcome_model(
963964
If we wish to winsorize the propensity score this can be set to clip the high
964965
and low values of the propensity at 0 + winsorize_boundary and 1-winsorize_boundary
965966
967+
spline_knots: int, default 30
968+
The number of knots we use in the 0 - 1 interval to create our spline function
969+
966970
Returns
967971
-------
968972
idata_outcome : arviz.InferenceData
@@ -1026,11 +1030,11 @@ class initialisation.
10261030
"beta_ps_spline",
10271031
priors["beta_ps"][0],
10281032
priors["beta_ps"][1],
1029-
size=34,
1033+
size=spline_knots + 4,
10301034
)
10311035
B = dmatrix(
10321036
"bs(ps, knots=knots, degree=3, include_intercept=True, lower_bound=0, upper_bound=1) - 1",
1033-
{"ps": p, "knots": np.linspace(0, 1, 30)},
1037+
{"ps": p, "knots": np.linspace(0, 1, spline_knots)},
10341038
)
10351039
B_f = np.asarray(B, order="F")
10361040
splines_summed = pm.Deterministic(

0 commit comments

Comments
 (0)