jonathancornelissen / highfrequency

The highfrequency package contains an extensive toolkit for the use of highfrequency financial data in R. It contains functionality to manage, clean and match highfrequency trades and quotes data. Furthermore, it enables users to: calculate easily various liquidity measures, estimate and forecast volatility, and investigate microstructure noise and intraday periodicity.
147 stars 63 forks source link

Is the parzen kernel implemented correctly #91

Closed travis-leith closed 1 year ago

travis-leith commented 2 years ago

I am reading through "Analyzing intraday financial data in R: The highfrequency package". There are many new concepts and in the interests of time, I am limiting myself to go 1 reference deep.

I see the definition of the parzen kernel according to Barndorff-Nielsen et al (2008) is image and according to Barndorff-Nielsen et al (2009) image Note that the function is $0$ for $x>1$.

Your implementation is not consistent with this

case 9: //Parzen
    if (thex > .5) {
      return( 2*(1-thex)*(1-thex)*(1-thex));
    }  else {
      return(1- 6 * pow(thex, 2.0) +6 * pow(thex, 3.0));
    }
    break;

but I don't know if the domain of this function is restricted in some other part of the code, such that this is not a problem.

onnokleen commented 2 years ago

Hi travis-leith, thanks a lot for your feedback. I will look into it but June is really busy so it might take a while for my final response. Best, Onno

onnokleen commented 1 year ago

Hi travis-leith, sorry for the late reply: The implementation is fine as is in my opinion. as we are not submitting any number larger than one as you can see in line 98 of realizedMeasures.cpp. @kboudt Can you close this issue?