statsmodels の summary の t について
どうやら、tは 標本分布を t分布と仮定した際の coef=0 の T の値っぽい。
t が 0から遠ければ遠いほど、coef が 0でない確率が高い。要は相関がある。
from patsy import dmatrices import statsmodels.api as sm df = sm.datasets.get_rdataset("Guerry", "HistData").data vars = ['Department', 'Lottery', 'Literacy', 'Wealth', 'Region'] df = df[vars].dropna() y, X = dmatrices('Lottery ~ Literacy + Wealth + Region', data=df, return_type='dataframe') mod = sm.OLS(y, X) res = mod.fit() res.summary()
OLS Regression Results ============================================================================== Dep. Variable: Lottery R-squared: 0.338 Model: OLS Adj. R-squared: 0.287 Method: Least Squares F-statistic: 6.636 Date: Wed, 17 Apr 2019 Prob (F-statistic): 1.07e-05 Time: 14:49:35 Log-Likelihood: -375.30 No. Observations: 85 AIC: 764.6 Df Residuals: 78 BIC: 781.7 Df Model: 6 Covariance Type: nonrobust =============================================================================== coef std err t P>|t| [0.025 0.975] ------------------------------------------------------------------------------- Intercept 38.6517 9.456 4.087 0.000 19.826 57.478 Region[T.E] -15.4278 9.727 -1.586 0.117 -34.793 3.938 Region[T.N] -10.0170 9.260 -1.082 0.283 -28.453 8.419 Region[T.S] -4.5483 7.279 -0.625 0.534 -19.039 9.943 Region[T.W] -10.0913 7.196 -1.402 0.165 -24.418 4.235 Literacy -0.1858 0.210 -0.886 0.378 -0.603 0.232 Wealth 0.4515 0.103 4.390 0.000 0.247 0.656 ============================================================================== Omnibus: 3.049 Durbin-Watson: 1.785 Prob(Omnibus): 0.218 Jarque-Bera (JB): 2.694 Skew: -0.340 Prob(JB): 0.260 Kurtosis: 2.454 Cond. No. 371. ============================================================================== Warnings: [1] Standard Errors assume that the covariance matrix of the errors is correctly specified.