title: Why is statsmodels.api producing R^2 of 1.000?
body: <p>I'm using statsmodel to do simple and multiple linear regression and I'm getting bad R^2 values from the summary.  The coefficients look to be calculated correctly, but I get an R^2 of 1.000 which is impossible for my data.  I graphed it in excel and I should be getting around 0.93, not 1.</p>
  
  <p>I'm using a mask to filter data to send into the model and I'm wondering if that could be the issue, but to me the data looks fine.  I am fairly new to python and statsmodel so maybe I'm missing something here.</p>
  
  <pre><code>import statsmodels.api as sm
  
      for i, df in enumerate(fallwy_xy):   # Iterate through list of dataframes
          if len(df.index) &gt; 0:            # Check if frame is empty or not
              mask3 = (df['fnu'] &gt;= low)   # Mask data below 'low' variable
              valid3 = df[mask3]
              if len(valid3) &gt; 0:          #  Check if there is data in range of mask3
                  X = valid3[['logfnu', 'logdischarge']]
                  y = valid3[['logssc']]
                  estm = sm.OLS(y, X).fit()
                  X = valid3[['logfnu']]
                  y = valid3[['logssc']]
                  ests = sm.OLS(y, X).fit()
  </code></pre>