statsmodels中的summary解读(OLS)
Dep.varible | y | 输出y变量的名称 |
---|---|---|
Model | OLS | 使用的参数确定的模型OLS |
Method | Least Squares | 使用最小二乘法确定参数 |
Date | Sat,10 Aug 2019 | 日期 |
Time | 18:10:04 | 时间 |
No.observations | 14 | 样本数目 |
Df Residuals | 12 | 残差自由度(观测数-参数数目+1) |
Df Model | 1 | 模型参数个数 |
R-squared | 0.918 | 可决定系数,通过数据的变化表征拟合的好坏 |
Adj-R-Squared | 0.911 | 修正R |
F-statistic | 134.7 | f统计检验量 |
Prob (F-statistic) | f检验对应的p值 | 7e-08 |
Log-likelihood | – | 对数极大似然法 |
AIC | – | The Akaike Information Criterion. Adjusts the log-likelihood based on the number of observations and the complexity of the model. |
BIC | – | The Bayesian Information Criterion. Similar to the AIC, but has a higher penalty for models with more parameters. |
Omnibus | – | D’Angostino’s test. It provides a combined statistical test for the presence of skewness and kurtosis. |
Prob(Omnibus) | – | The above statistic turned into a probability |
Jarque-Bera | – | A different test of the skewness and kurtosis |
Prob (JB) | – | The above statistic turned into a probability |
Durbin-Watson | – | A test for the presence of autocorrelation (that the errors are not independent.) Often important in time-series analysis |
Cond. No | – | A test for multicollinearity (if in a fit with multiple parameters, the parameters are related with each other). |
https://blog.datarobot.com/ordinary-least-squares-in-python
一、SSE(和方差)
该统计参数计算的是拟合数据和原始数据对应点的误差的平方和,计算公式如下
SSE越接近于0,说明模型选择和拟合更好,数据预测也越成功。接下来的MSE和RMSE因为和SSE是同出一宗,所以效果一样
二、MSE(均方差)
该统计参数是预测数据和原始数据对应点误差的平方和的均值,也就是SSE/n,和SSE没有太大的区别,计算公式如下
三、RMSE(均方根)
该统计参数,也叫回归系统的拟合标准差,是MSE的平方根,就算公式如下
在这之前,我们所有的误差参数都是基于预测值(y_hat)和原始值(y)之间的误差(即点对点)。从下面开始是所有的误差都是相对原始数据平均值(y_ba)而展开的(即点对全)!!!
四、R-square(确定系数)
在讲确定系数之前,我们需要介绍另外两个参数SSR和SST,因为确定系数就是由它们两个决定的
(1)SSR:Sum of squares of the regression,即预测数据与原始数据均值之差的平方和,公式如下
(2)SST:Total sum of squares,即原始数据和均值之差的平方和,公式如下
细心的网友会发现,SST=SSE+SSR,呵呵只是一个有趣的问题。而我们的“确定系数”是定义为SSR和SST的比值,故
其实“确定系数”是通过数据的变化来表征一个拟合的好坏。由上面的表达式可以知道“确定系数”的正常取值范围为[0 1],越接近1,表明方程的变量对y的解释能力越强,这个模型对数据拟合的也较好
五、修正的公式(Adj. R-squared)
其中n是样本数量(No. Observations),p是模型中变量的个数(Df Model)。
我们知道在其他变量不变的情况下,引入新的变量,总能提高模型的。修正就是相当于给变量的个数加惩罚项。
换句话说,如果两个模型,样本数一样,一样,那么从修正的角度看,使用变量个数少的那个模型更优。使用修正也算一种奥卡姆剃刀的实例。