title: How to retrieve model estimates from statsmodels?
body: <p>From a dataset like this:</p>
  
  <pre><code>import pandas as pd
  import numpy as np
  import statsmodels.api as sm
  
  # A dataframe with two variables
  np.random.seed(123)
  rows = 12
  rng = pd.date_range('1/1/2017', periods=rows, freq='D')
  df = pd.DataFrame(np.random.randint(100,150,size=(rows, 2)), columns=['y', 'x']) 
  df = df.set_index(rng)
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/XaK90.png" rel="noreferrer"><img src="https://i.stack.imgur.com/XaK90.png" alt="enter image description here"></a></p>
  
  <p>...and a linear regression model like this:</p>
  
  <pre><code>x = sm.add_constant(df['x'])
  model = sm.OLS(df['y'], x).fit()
  </code></pre>
  
  <p>... you can easily retrieve some model coefficients this way:</p>
  
  <pre><code>print(model.params)
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/jHV2z.png" rel="noreferrer"><img src="https://i.stack.imgur.com/jHV2z.png" alt="enter image description here"></a></p>
  
  <p>But I just can't find out how to retrieve all other parameters from the model summary:</p>
  
  <pre><code>print(str(model.summary()))
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/TdmHU.png" rel="noreferrer"><img src="https://i.stack.imgur.com/TdmHU.png" alt="enter image description here"></a></p>
  
  <p>As stated in the question, I'm particularly interested in <strong>R-squared</strong>.</p>
  
  <p>From the post <a href="https://stackoverflow.com/questions/37508158/how-to-extract-a-particular-value-from-the-ols-summary-in-pandas">How to extract a particular value from the OLS-summary in Pandas?</a> I learned that you could just use <code>print(model.r2)</code> to do the same thing there. But that does not seem to work for statsmodels.</p>
  
  <p>Any suggestions?</p>