@@ -613,13 +613,13 @@ def fit_outcome_model(
613
613
coords ,
614
614
priors = {
615
615
"b_outcome" : [0 , 1 ],
616
- "a_outcome" : [0 , 1 ],
617
616
"sigma" : 1 ,
618
617
"beta_ps" : [0 , 1 ],
619
618
},
620
619
noncentred = True ,
621
620
normal_outcome = True ,
622
621
spline_component = False ,
622
+ winsorize_boundary = 0.0 ,
623
623
):
624
624
"""
625
625
Fit a Bayesian outcome model using covariates and previously estimated propensity scores.
@@ -643,7 +643,6 @@ def fit_outcome_model(
643
643
priors : dict, optional
644
644
Dictionary specifying priors for outcome model parameters:
645
645
- "b_outcome": list [mean, std] for regression coefficients.
646
- - "a_outcome": list [mean, std] for the intercept.
647
646
- "sigma": standard deviation of the outcome noise (default 1).
648
647
649
648
noncentred : bool, default True
@@ -657,6 +656,10 @@ def fit_outcome_model(
657
656
If True, include a spline basis expansion on the propensity score to allow
658
657
flexible (nonlinear) adjustment. Uses B-splines with 30 internal knots.
659
658
659
+ winsorize_boundary : float, default 0.0
660
+ If we wish to winsorize the propensity score this can be set to clip the high
661
+ and low values of the propensity at 0 + winsorize_boundary and 1-winsorize_boundary
662
+
660
663
Returns
661
664
-------
662
665
idata_outcome : arviz.InferenceData
@@ -677,8 +680,8 @@ def fit_outcome_model(
677
680
posterior of the treatment model, randomly selecting one posterior draw
678
681
per call. This term is estimated initially in the InversePropensity
679
682
class initialisation.
680
- - The term `beta_ps[0] * p + beta_ps[1] * (p * treatment) ` captures both
681
- main and interaction effects of the propensity score.
683
+ - The term `beta_ps[0] * p` captures both
684
+ main effects of the propensity score.
682
685
- Including spline adjustment enables modeling nonlinear relationships
683
686
between the propensity score and the outcome.
684
687
@@ -711,6 +714,7 @@ class initialisation.
711
714
712
715
chosen = np .random .choice (range (propensity_scores .shape [1 ]))
713
716
p = propensity_scores [:, chosen ].values
717
+ p = np .clip (p , winsorize_boundary , 1 - winsorize_boundary )
714
718
715
719
mu_outcome = pm .math .dot (X_data_outcome , beta ) + beta_ps * p
716
720
0 commit comments