Open ChrisAllisonMalta opened 1 year ago
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.
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 functionStats.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?