Skip to content

Commit 100784f

Browse files
committed
_input_validation -> input_validation
1 parent 224ec84 commit 100784f

8 files changed

+14
-14
lines changed

causalpy/exp_inverse_propensity_weighting.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ def __init__(
8484
self.formula = formula
8585
self.outcome_variable = outcome_variable
8686
self.weighting_scheme = weighting_scheme
87-
self._input_validation()
87+
self.input_validation()
8888

8989
t, X = dmatrices(formula, self.data)
9090
self._t_design_info = t.design_info
@@ -97,7 +97,7 @@ def __init__(
9797
self.coords = COORDS
9898
self.model.fit(X=self.X, t=self.t, coords=COORDS)
9999

100-
def _input_validation(self):
100+
def input_validation(self):
101101
"""Validate the input data and model formula for correctness"""
102102
treatment = self.formula.split("~")[0]
103103
test = treatment.strip() in self.data.columns

causalpy/expt_diff_in_diff.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ def __init__(
8383
self.formula = formula
8484
self.time_variable_name = time_variable_name
8585
self.group_variable_name = group_variable_name
86-
self._input_validation()
86+
self.input_validation()
8787

8888
y, X = dmatrices(formula, self.data)
8989
self._y_design_info = y.design_info
@@ -177,7 +177,7 @@ def __init__(
177177
else:
178178
raise ValueError("Model type not recognized")
179179

180-
def _input_validation(self):
180+
def input_validation(self):
181181
"""Validate the input data and model formula for correctness"""
182182
if "post_treatment" not in self.formula:
183183
raise FormulaException(

causalpy/expt_instrumental_variable.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ def __init__(
105105
self.formula = formula
106106
self.instruments_formula = instruments_formula
107107
self.model = model
108-
self._input_validation()
108+
self.input_validation()
109109

110110
y, X = dmatrices(formula, self.data)
111111
self._y_design_info = y.design_info
@@ -139,7 +139,7 @@ def __init__(
139139
X=self.X, Z=self.Z, y=self.y, t=self.t, coords=COORDS, priors=self.priors
140140
)
141141

142-
def _input_validation(self):
142+
def input_validation(self):
143143
"""Validate the input data and model formula for correctness"""
144144
treatment = self.instruments_formula.split("~")[0]
145145
test = treatment.strip() in self.instruments_data.columns

causalpy/expt_prepostfit.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ def __init__(
4242
**kwargs,
4343
) -> None:
4444
super().__init__(model=model, **kwargs)
45-
self._input_validation(data, treatment_time)
45+
self.input_validation(data, treatment_time)
4646
self.treatment_time = treatment_time
4747
# set experiment type - usually done in subclasses
4848
self.expt_type = "Pre-Post Fit"
@@ -91,7 +91,7 @@ def __init__(
9191
self.post_impact
9292
)
9393

94-
def _input_validation(self, data, treatment_time):
94+
def input_validation(self, data, treatment_time):
9595
"""Validate the input data and model formula for correctness"""
9696
if isinstance(data.index, pd.DatetimeIndex) and not isinstance(
9797
treatment_time, pd.Timestamp

causalpy/expt_prepostnegd.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ def __init__(
9090
self.formula = formula
9191
self.group_variable_name = group_variable_name
9292
self.pretreatment_variable_name = pretreatment_variable_name
93-
self._input_validation()
93+
self.input_validation()
9494

9595
y, X = dmatrices(formula, self.data)
9696
self._y_design_info = y.design_info
@@ -142,7 +142,7 @@ def __init__(
142142
{"coeffs": self._get_treatment_effect_coeff()}
143143
)
144144

145-
def _input_validation(self) -> None:
145+
def input_validation(self) -> None:
146146
"""Validate the input data and model formula for correctness"""
147147
if not _is_variable_dummy_coded(self.data[self.group_variable_name]):
148148
raise DataException(

causalpy/expt_regression_discontinuity.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ def __init__(
9292
self.treatment_threshold = treatment_threshold
9393
self.epsilon = epsilon
9494
self.bandwidth = bandwidth
95-
self._input_validation()
95+
self.input_validation()
9696

9797
if self.bandwidth is not np.inf:
9898
fmin = self.treatment_threshold - self.bandwidth
@@ -171,7 +171,7 @@ def __init__(
171171
) - np.squeeze(self.pred_discon[0])
172172
# ******************************************************************************
173173

174-
def _input_validation(self):
174+
def input_validation(self):
175175
"""Validate the input data and model formula for correctness"""
176176
if "treated" not in self.formula:
177177
raise FormulaException(

causalpy/expt_regression_kink.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ def __init__(
5353
self.kink_point = kink_point
5454
self.epsilon = epsilon
5555
self.bandwidth = bandwidth
56-
self._input_validation()
56+
self.input_validation()
5757

5858
if self.bandwidth is not np.inf:
5959
fmin = self.kink_point - self.bandwidth
@@ -101,7 +101,7 @@ def __init__(
101101
mu_kink_left, mu_kink, mu_kink_right, epsilon
102102
)
103103

104-
def _input_validation(self):
104+
def input_validation(self):
105105
"""Validate the input data and model formula for correctness"""
106106
if "treated" not in self.formula:
107107
raise FormulaException(

docs/source/_static/classes.png

4.74 KB
Loading

0 commit comments

Comments
 (0)