I playing around with some regression analyses in Python using StatsModels. I am getting a little confused with some terminology and just wanted to clarify.

I have run a regression and get the following results.

 OLS Regression Results                            
Dep. Variable:                    TTo   R-squared:                       0.048
Model:                            OLS   Adj. R-squared:                  0.032
Method:                 Least Squares   F-statistic:                     2.933
Date:                Fri, 22 Jun 2018   Prob (F-statistic):             0.0921
Time:                        11:44:53   Log-Likelihood:                -380.18
No. Observations:                  60   AIC:                             764.4
Df Residuals:                      58   BIC:                             768.5
Df Model:                           1                                         
Covariance Type:            nonrobust                                         
                      coef    std err          t      P>|t|      [0.025      0.975]
Intercept         472.7183     17.942     26.347      0.000     436.804     508.633
Var1    -1.2158      0.710     -1.713      0.092      -2.637       0.205
Omnibus:                       25.817   Durbin-Watson:                   0.371
Prob(Omnibus):                  0.000   Jarque-Bera (JB):                4.466
Skew:                           0.107   Prob(JB):                        0.107
Kurtosis:                       1.681   Cond. No.                         25.3

Now, I get the R-squared values etc and the significance tests. Where can I find the mean squared error which shows the absolute measure of fit within the summary? Is it even there but hidden in something?

I found that I can use model.resid_mse, which from the documentation stats it provides a residual sum of squares by dividing by the residual degrees of freedom. Is this the same as the average sum of squares? Is this just assuming it's from a sample? am I being simple?

It this is what I am after, then surely to get the RMSE, I can just take the square root of the resid_mse (such as np.sqrt(model.resid_mse)) to find the absolute fit of the model?

Any help to clarify is greatly appreciated.



  • $\begingroup$ the Root Mean Squared Error (RMSE) can easily be calculated by squaring the absolute errors, taking the mean (average) of those squared values, and then taking the square root of that mean. It would seem easier to take the average of the absolute values of the errors, but in the early days this was considered disallowed as "absolute value" has no derivative, and "square root" does have a derivative. $\endgroup$ – James Phillips Jun 22 '18 at 13:32
  • 1
    $\begingroup$ Thanks for your response, James. I was just wondering if the 'mse_resid' method within the returned OLS model is the mean squared error. What I was confused with was that this mean squared error of the residuals are divided by the residual degrees of freedom as mentioned here $\endgroup$ – BillyJo_rambler Jun 24 '18 at 14:42
  • $\begingroup$ Since i don't think you will get that in statsmodels, i can't write this as an answer. However below function can give you precisely that. def rmse_accuracy_percentage(actual,predicted): print("RMSE is:",np.round(np.sqrt(sum(((np.array(a)-np.array(b))**2))/len(a)),2)) $\endgroup$ – Enthusiast Aug 11 at 9:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.