Dear Rcpp-devel list,
I am looking to carry out a fixed window length rolling ADF test (with no
intercept), over some time series data currently in xts format.
To do this I need to first fit a regression to the data, then use the residuals
as an input into the ADF test, from which I can get a p-value to see if I can
reject the idea of the data having a unit root or not.
I know I can use fastLm() from RcppArmadillo for the regression, and I know
that the ADF test also runs an OLS regression as part of it too, I would have
assumed finding unit roots to be a reasonably common use, but currently can’t
find any “out of the box” functions that carry out C++ optimised ADF tests, are
there any that can easily be sourced/included into Rcpp?
Secondly, in terms of implementation, originally I was using rollapply(), to
carry out my rolling window ADF test, with all lm() calls in both the original
regression and the adf test being converted to fastLm() and basically using the
adfTest2() function created here
(http://blog.quanttrader.org/2012/04/adftest-function-enhanced-with-rcpp-armadillo/)
and put it into a rollapply, but since rollapply() can sometimes be slow, I
was wondering if it would make sense to use a for loop to carry out the rolling
ADF test instead, and thus was hoping for a Rcpp/RcppArmadillo implementation
of the ADF test? is there one?
I am relatively new to C++, so just to confirm for the fixed window length
rolling function would I just be creating a new matrix at each row, which is
basically just a subset of the original data that has been put in? and the
using the matrix in my function? and would I be overwriting the matrix each
time i get to a new row? I think there might be some memory management issues
here, so some memory efficient suggested examples would be great!
Any advice/links on carrying out any part of this would be much appreciated.
Thanks in advance,
HLM
_______________________________________________
Rcpp-devel mailing list
Rcpp-devel@lists.r-forge.r-project.org
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel