@@ -11,6 +11,7 @@ class ExperimentalDesign:
11
11
"""Base class for experiment designs"""
12
12
13
13
prediction_model = None
14
+ outcome_variable_name = None
14
15
15
16
def __init__ (self , prediction_model = None , ** kwargs ):
16
17
if prediction_model is not None :
@@ -34,6 +35,7 @@ def __init__(self, data, treatment_time, formula, prediction_model=None, **kwarg
34
35
self ._y_design_info = y .design_info
35
36
self ._x_design_info = X .design_info
36
37
self .labels = X .design_info .column_names
38
+ self .outcome_variable_name = y .design_info .column_names [0 ]
37
39
self .pre_y , self .pre_X = np .asarray (y ), np .asarray (X )
38
40
# process post-intervention data
39
41
(new_y , new_x ) = build_design_matrices (
@@ -174,20 +176,19 @@ def __init__(
174
176
data ,
175
177
formula ,
176
178
time_variable_name = "t" ,
177
- outcome_variable_name = "y" ,
178
179
prediction_model = None ,
179
180
** kwargs ,
180
181
):
181
182
super ().__init__ (prediction_model = prediction_model , ** kwargs )
182
183
self .data = data
183
184
self .formula = formula
184
185
self .time_variable_name = time_variable_name
185
- self .outcome_variable_name = outcome_variable_name
186
186
y , X = dmatrices (formula , self .data )
187
187
self ._y_design_info = y .design_info
188
188
self ._x_design_info = X .design_info
189
189
self .labels = X .design_info .column_names
190
190
self .y , self .X = np .asarray (y ), np .asarray (X )
191
+ self .outcome_variable_name = y .design_info .column_names [0 ]
191
192
192
193
# TODO: `treated` is a deterministic function of group and time, so this should be a function rather than supplied data
193
194
@@ -307,20 +308,19 @@ def __init__(
307
308
treatment_threshold ,
308
309
prediction_model = None ,
309
310
running_variable_name = "x" ,
310
- outcome_variable_name = "y" ,
311
311
** kwargs ,
312
312
):
313
313
super ().__init__ (prediction_model = prediction_model , ** kwargs )
314
314
self .data = data
315
315
self .formula = formula
316
316
self .running_variable_name = running_variable_name
317
- self .outcome_variable_name = outcome_variable_name
318
317
self .treatment_threshold = treatment_threshold
319
318
y , X = dmatrices (formula , self .data )
320
319
self ._y_design_info = y .design_info
321
320
self ._x_design_info = X .design_info
322
321
self .labels = X .design_info .column_names
323
322
self .y , self .X = np .asarray (y ), np .asarray (X )
323
+ self .outcome_variable_name = y .design_info .column_names [0 ]
324
324
325
325
# TODO: `treated` is a deterministic function of x and treatment_threshold, so this could be a function rather than supplied data
326
326
0 commit comments