Skip to content

Commit cf9db99

Browse files
Merge pull request #191 from CITCOM-project/validation_move
Utils Package
2 parents 0625639 + 75329b8 commit cf9db99

File tree

4 files changed

+8
-5
lines changed

4 files changed

+8
-5
lines changed

causal_testing/utils/__init__.py

Whitespace-only changes.

causal_testing/testing/validation.py renamed to causal_testing/utils/validation.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
class CausalValidator:
99
"""A suite of validation tools to perform Quantitive Bias Analysis to back up causal claims"""
1010

11-
def estimate_robustness(self, model: RegressionResultsWrapper, q=1, alpha=1):
11+
@staticmethod
12+
def estimate_robustness(model: RegressionResultsWrapper, q=1, alpha=1):
1213
"""Calculate the robustness of a linear regression model. This allow
1314
the user to identify how large an unidentified confounding variable
1415
would need to be to nullify the causal relationship under test."""
@@ -24,7 +25,8 @@ def estimate_robustness(self, model: RegressionResultsWrapper, q=1, alpha=1):
2425

2526
return rv
2627

27-
def estimate_e_value(self, risk_ratio: float) -> float:
28+
@staticmethod
29+
def estimate_e_value(risk_ratio: float) -> float:
2830
"""Calculate the E value from a risk ratio. This allow
2931
the user to identify how large a risk an unidentified confounding
3032
variable would need to be to nullify the causal relationship
@@ -36,7 +38,8 @@ def estimate_e_value(self, risk_ratio: float) -> float:
3638
risk_ratio_prime = 1 / risk_ratio
3739
return risk_ratio_prime + math.sqrt(risk_ratio_prime * (risk_ratio_prime - 1))
3840

39-
def estimate_e_value_using_ci(self, risk_ratio: float, confidence_intervals: tuple[float, float]) -> float:
41+
@staticmethod
42+
def estimate_e_value_using_ci(risk_ratio: float, confidence_intervals: tuple[float, float]) -> float:
4043
"""Calculate the E value from a risk ratio and it's confidence intervals.
4144
This allow the user to identify how large a risk an unidentified
4245
confounding variable would need to be to nullify the causal relationship

tests/testing_tests/test_causal_test_outcome.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
from causal_testing.testing.causal_test_outcome import ExactValue, SomeEffect, Positive, Negative, NoEffect
33
from causal_testing.testing.causal_test_result import CausalTestResult, TestValue
44
from causal_testing.testing.estimators import LinearRegressionEstimator
5-
from causal_testing.testing.validation import CausalValidator
5+
from causal_testing.utils.validation import CausalValidator
66

77

88
class TestCausalTestOutcome(unittest.TestCase):

tests/testing_tests/test_estimators.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
InstrumentalVariableEstimator,
1010
)
1111
from causal_testing.specification.variable import Input
12-
from causal_testing.testing.validation import CausalValidator
12+
from causal_testing.utils.validation import CausalValidator
1313

1414

1515
def plot_results_df(df):

0 commit comments

Comments
 (0)