-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
BUG: rolling_window yields unexpected results with win_type='triang' #7618
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
these are
yields the weights |
Understood. It looks like there is some logic in rolling_window that is On Mon, Jun 30, 2014 at 11:13 AM, jreback [email protected] wrote:
|
@AllenDowney certainly possible (not sure whether this should be normalized or not). Much of this I don't think is actually tested (as it relies on the weights from scipy). Want to put some test cases together? |
I don't have a pandas dev environment set up, but here's a simple case:
Currently only 'boxcar' is passing. One theory: when rolling_window calls algos.roll_window, should it be Allen On Mon, Jun 30, 2014 at 11:48 AM, jreback [email protected] wrote:
|
Do these need to be normalized? |
Yes, I think so. On Mon, Jun 30, 2014 at 1:12 PM, jreback [email protected] wrote:
|
so why is 'boxcar' right then? |
Because the window is all 1s, it is already normalized. On Mon, Jun 30, 2014 at 1:19 PM, jreback [email protected] wrote:
|
Indeed it appears to be a normalization issue. The result is correct (i.e. it overlaps with the original signal) if you multiply it by the following number: window / sum(sig.get_window('triang', window)) |
either of you want to put some tests / fix in place for this? ideally some comprehensive testing of all window types to validate this |
I might have time to do this next week, but would not be deeply offended if Allen On Thu, Aug 7, 2014 at 10:24 AM, jreback [email protected] wrote:
|
I ran across this while looking into This roughly illustrates my point:
I suppose this is nothing new, but it seems like a place where unaware users could get tripped up. |
Here's the example in the documentation, modified to have non-zero mean:
The rolling boxcar window is centered around 10, as expected.
The triang window is centered around 6. That suggests that the weights in the window don't add up to 1.
Either that or my expectation of how it should work is wrong?
The text was updated successfully, but these errors were encountered: