30
30
import numpy as np
31
31
from scipy import stats
32
32
import pandas as pd
33
+ import warnings
33
34
from statsmodels import iolib
34
- from statsmodels .tools . sm_exceptions import SingularMatrixWarning
35
+ from statsmodels .tools import sm_exceptions
35
36
36
37
37
38
def _make_df_square (table ):
@@ -618,9 +619,8 @@ def homogeneity(self, method="stuart_maxwell"):
618
619
try :
619
620
statistic = n_obs * np .dot (d , np .linalg .solve (vmat , d ))
620
621
except np .linalg .LinAlgError :
621
- import warnings
622
622
warnings .warn ("Unable to invert covariance matrix" ,
623
- SingularMatrixWarning )
623
+ sm_exceptions . SingularMatrixWarning )
624
624
b = _Bunch ()
625
625
b .statistic = np .nan
626
626
b .pvalue = np .nan
@@ -1126,11 +1126,22 @@ def test_null_odds(self, correction=False):
1126
1126
1127
1127
@cache_readonly
1128
1128
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
+ """
1129
1135
odds_ratio = np .sum (self ._ad / self ._n ) / np .sum (self ._bc / self ._n )
1130
1136
return odds_ratio
1131
1137
1132
1138
@cache_readonly
1133
1139
def logodds_pooled (self ):
1140
+ """
1141
+ Returns the logarithm of the pooled odds ratio.
1142
+
1143
+ See oddsratio_pooled for more information.
1144
+ """
1134
1145
return np .log (self .oddsratio_pooled )
1135
1146
1136
1147
@cache_readonly
@@ -1145,6 +1156,8 @@ def riskratio_pooled(self):
1145
1156
@cache_readonly
1146
1157
def risk_pooled (self ):
1147
1158
# Deprecated due to name being misleading
1159
+ msg = "'risk_pooled' is deprecated, use 'riskratio_pooled' instead"
1160
+ warnings .warn (msg , DeprecationWarning )
1148
1161
return self .riskratio_pooled
1149
1162
1150
1163
@cache_readonly
0 commit comments