@@ -33,38 +33,62 @@ def __eq__(self, other):
3333 same_adjustment_set = set (self .adjustment_vars ) == set (other .adjustment_vars )
3434 return same_type and same_treatment and same_outcome and same_effect and same_adjustment_set
3535
36-
37- class ShouldCause (MetamorphicRelation ):
38- """Class representing a should cause metamorphic relation."""
39-
4036 def to_json_stub (
4137 self ,
4238 skip : bool = False ,
4339 estimate_type : str = "coefficient" ,
4440 effect_type : str = "direct" ,
4541 estimator : str = "LinearRegressionEstimator" ,
42+ alpha : float = 0.05 ,
4643 ) -> dict :
4744 """
4845 Convert to a JSON frontend stub string for user customisation.
4946 :param skip: Whether to skip the test (default False).
5047 :param effect_type: The type of causal effect to consider (total or direct)
5148 :param estimate_type: The estimate type to use when evaluating tests
5249 :param estimator: The name of the estimator class to use when evaluating the test
50+ :param alpha: The significance level to use when calculating the confidence intervals
5351 """
5452 return {
5553 "name" : str (self ),
5654 "estimator" : estimator ,
5755 "estimate_type" : estimate_type ,
5856 "effect" : effect_type ,
5957 "treatment_variable" : self .base_test_case .treatment_variable ,
60- "expected_effect" : {self .base_test_case .outcome_variable : "SomeEffect" },
6158 "formula" : (
6259 f"{ self .base_test_case .outcome_variable } ~ "
6360 f"{ ' + ' .join ([self .base_test_case .treatment_variable ] + self .adjustment_vars )} "
6461 ),
62+ "alpha" : alpha ,
6563 "skip" : skip ,
6664 }
6765
66+
67+ class ShouldCause (MetamorphicRelation ):
68+ """Class representing a should cause metamorphic relation."""
69+
70+ def to_json_stub (
71+ self ,
72+ skip : bool = False ,
73+ estimate_type : str = "coefficient" ,
74+ effect_type : str = "direct" ,
75+ estimator : str = "LinearRegressionEstimator" ,
76+ alpha : float = 0.05 ,
77+ ) -> dict :
78+ """
79+ Convert to a JSON frontend stub string for user customisation.
80+ :param skip: Whether to skip the test (default False).
81+ :param effect_type: The type of causal effect to consider (total or direct)
82+ :param estimate_type: The estimate type to use when evaluating tests
83+ :param estimator: The name of the estimator class to use when evaluating the test
84+ :param alpha: The significance level to use when calculating the confidence intervals
85+ """
86+ return super ().to_json_stub (
87+ skip = skip , estimate_type = estimate_type , effect_type = effect_type , estimator = estimator , alpha = alpha
88+ ) | {
89+ "expected_effect" : {self .base_test_case .outcome_variable : "SomeEffect" },
90+ }
91+
6892 def __str__ (self ):
6993 formatted_str = f"{ self .base_test_case .treatment_variable } --> { self .base_test_case .outcome_variable } "
7094 if self .adjustment_vars :
@@ -81,27 +105,20 @@ def to_json_stub(
81105 estimate_type : str = "coefficient" ,
82106 effect_type : str = "direct" ,
83107 estimator : str = "LinearRegressionEstimator" ,
108+ alpha : float = 0.05 ,
84109 ) -> dict :
85110 """
86111 Convert to a JSON frontend stub string for user customisation.
87112 :param skip: Whether to skip the test (default False).
88113 :param effect_type: The type of causal effect to consider (total or direct)
89114 :param estimate_type: The estimate type to use when evaluating tests
90115 :param estimator: The name of the estimator class to use when evaluating the test
116+ :param alpha: The significance level to use when calculating the confidence intervals
91117 """
92- return {
93- "name" : str (self ),
94- "estimator" : estimator ,
95- "estimate_type" : estimate_type ,
96- "effect" : effect_type ,
97- "treatment_variable" : self .base_test_case .treatment_variable ,
118+ return super ().to_json_stub (
119+ skip = skip , estimate_type = estimate_type , effect_type = effect_type , estimator = estimator , alpha = alpha
120+ ) | {
98121 "expected_effect" : {self .base_test_case .outcome_variable : "NoEffect" },
99- "formula" : (
100- f"{ self .base_test_case .outcome_variable } ~ "
101- f"{ ' + ' .join ([self .base_test_case .treatment_variable ] + self .adjustment_vars )} "
102- ),
103- "alpha" : 0.05 ,
104- "skip" : skip ,
105122 }
106123
107124 def __str__ (self ):
0 commit comments