Skip to content
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

Deedle Finance.ewmVol is returning the rolling mean not the standard deviation #555

Open
ChrisAllisonMalta opened this issue Feb 6, 2023 · 1 comment

Comments

@ChrisAllisonMalta
Copy link

Copying from Stackoverflow

I am trying to do some calculations that I previously had done in python in c#. I came across the Deedle library and seems like it will fit the bill as a Panda's replacement.

When I came to test the library, I get very different data to what I get in Pandas when I test the Exponentially Weighted Standard Deviation.

If I create an array of doubles with a sequence from 1 through 50, in Pandas by the end of the series I'm getting data like

print(df['Numbers'].ewm(adjust=False, span=10).std().tail())

double | Pandas EW std

45 | 5.238847
46 | 5.239699
47 | 5.240413
48 | 5.241011
49 | 5.241511

When I run Finance.ewmVol(numberSeries, null, 10, null, null); I get very similar numbers to this function Stats.ewmMean(numberSeries, null, 10, null, null);

double | Deedle EW std | Deedle EW mean

45 | 41.5005 | 41.5005
46 | 42.5004 | 42.5004
47 | 43.5003 | 43.5003
48 | 44.5002 | 44.5002
49 | 45.5002 | 45.5002

Am I doing something wrong here?

@Choc13
Copy link
Contributor

Choc13 commented Jul 10, 2023

I just stumbled across this when looking at some other issues and might be able to offer some help as I've been using Finance.ewmVol quite a bit in my work recently. One thing that might be worth pointing out is that Finance.ewmVol makes an assumptions that you're dealing with a returns series for a financial asset/instrument and therefore that the expected value of the mean of the returns is 0. So I believe the functions in this module have been specifically designed for financial applications and so have made some assumptions about the input data.

This might be the source of problem, or maybe you were already aware of this, apologies if so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants