Skip to content

Commit 21f8216

Browse files
committed
add deprecation warning for deprecated method
1 parent f3e8b03 commit 21f8216

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

statsmodels/stats/contingency_tables.py

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,9 @@
3030
import numpy as np
3131
from scipy import stats
3232
import pandas as pd
33+
import warnings
3334
from statsmodels import iolib
34-
from statsmodels.tools.sm_exceptions import SingularMatrixWarning
35+
from statsmodels.tools import sm_exceptions
3536

3637

3738
def _make_df_square(table):
@@ -618,9 +619,8 @@ def homogeneity(self, method="stuart_maxwell"):
618619
try:
619620
statistic = n_obs * np.dot(d, np.linalg.solve(vmat, d))
620621
except np.linalg.LinAlgError:
621-
import warnings
622622
warnings.warn("Unable to invert covariance matrix",
623-
SingularMatrixWarning)
623+
sm_exceptions.SingularMatrixWarning)
624624
b = _Bunch()
625625
b.statistic = np.nan
626626
b.pvalue = np.nan
@@ -1126,11 +1126,22 @@ def test_null_odds(self, correction=False):
11261126

11271127
@cache_readonly
11281128
def oddsratio_pooled(self):
1129+
"""
1130+
The pooled odds ratio.
1131+
1132+
The value is an estimate of a common odds ratio across all of the
1133+
stratified tables.
1134+
"""
11291135
odds_ratio = np.sum(self._ad / self._n) / np.sum(self._bc / self._n)
11301136
return odds_ratio
11311137

11321138
@cache_readonly
11331139
def logodds_pooled(self):
1140+
"""
1141+
Returns the logarithm of the pooled odds ratio.
1142+
1143+
See oddsratio_pooled for more information.
1144+
"""
11341145
return np.log(self.oddsratio_pooled)
11351146

11361147
@cache_readonly
@@ -1145,6 +1156,8 @@ def riskratio_pooled(self):
11451156
@cache_readonly
11461157
def risk_pooled(self):
11471158
# Deprecated due to name being misleading
1159+
msg = "'risk_pooled' is deprecated, use 'riskratio_pooled' instead"
1160+
warnings.warn(msg, DeprecationWarning)
11481161
return self.riskratio_pooled
11491162

11501163
@cache_readonly

0 commit comments

Comments
 (0)