title: Pandas ols MovingOLS
body: <p>I have a question relative to the property of pd.stats.ols.MovingOLS. When I try to do moving window OLS regression with the MovingOLS function, I do not have my expected result. I set a <code>min_periods = 2</code> and a <code>window = 4</code> for this function. </p>
  
  <p>I realize that the OLS does not do the job when the window-end element is missing, even though the total number of observations satisfies the minimum observation requirement.</p>
  
  <p>For example, in the following data, I should have results at position 2 and 5. But since the last element in these windows are nan, the regression gives no result. But the total numbers in the windows exceed the minimum number requirement. Do you know how to fix it?</p>
  
  <pre><code>a = pd.Series([1,2,3,2,np.NaN,np.NaN,5,2,np.NaN,4.5,3.2,3,np.NaN,8])
  b = pd.Series([1,-2,np.NaN,2,5,2.5,5,2,np.NaN,4.5,np.NaN,2,np.NaN,])
  
  pd.stats.ols.MovingOLS(y=b, x=a, window_type='rolling', window=4,
                         min_periods=2, intercept=False).beta
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/C17uA.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/C17uA.png" alt="Data"></a></p>