title: How to get R-squared for robust regression (RLM) in Statsmodels?
body: <p>When it comes to measuring goodness of fit - R-Squared seems to be a commonly understood (and accepted) measure for "simple" linear models.
  But in case of <code>statsmodels</code> (as well as other statistical software) <a href="http://statsmodels.sourceforge.net/stable/examples/notebooks/generated/robust_models_0.html" rel="noreferrer">RLM</a> does not include R-squared together with regression results.
  Is there a way to get it calculated "manually", perhaps in a way similar to how it is done in <a href="http://www.ats.ucla.edu/stat/stata/faq/rregr2.htm" rel="noreferrer">Stata</a>?</p>
  
  <p>Or is there another measure that can be used / calculated from the results produced by <code>sm.RLS</code>?</p>
  
  <p>This is what Statsmodels is producing:</p>
  
  <pre><code>import numpy as np
  import statsmodels.api as sm
  
  # Sample Data with outliers
  nsample = 50
  x = np.linspace(0, 20, nsample)
  x = sm.add_constant(x)
  sig = 0.3
  beta = [5, 0.5]
  y_true = np.dot(x, beta)
  y = y_true + sig * 1. * np.random.normal(size=nsample)
  y[[39,41,43,45,48]] -= 5   # add some outliers (10% of nsample)
  
  # Regression with Robust Linear Model
  res = sm.RLM(y, x).fit()
  print(res.summary())
  </code></pre>
  
  <p>Which outputs:</p>
  
  <pre><code>                    Robust linear Model Regression Results                    
  ==============================================================================
  Dep. Variable:                      y   No. Observations:                   50
  Model:                            RLM   Df Residuals:                       48
  Method:                          IRLS   Df Model:                            1
  Norm:                          HuberT                                         
  Scale Est.:                       mad                                         
  Cov Type:                          H1                                         
  Date:                 Mo, 27 Jul 2015                                         
  Time:                        10:00:00                                         
  No. Iterations:                    17                                         
  ==============================================================================
                   coef    std err          z      P&gt;|z|      [95.0% Conf. Int.]
  ------------------------------------------------------------------------------
  const          5.0254      0.091     55.017      0.000         4.846     5.204
  x1             0.4845      0.008     61.555      0.000         0.469     0.500
  ==============================================================================
  </code></pre>