1
$\begingroup$

Is there source code that I can read to understand the dickey fuller test in detail to understand how it works. I am really confused on how the Dickey Fuller test / Augmented Dickey Fuller tests work. Some help would be really appreciated.

$\endgroup$
  • $\begingroup$ Did you google this? There are plenty or resources online. Search "Augmented Dicky Fuller test pdf" and you get plenty of stuff. Also see here $\endgroup$ – luchonacho Jul 22 '17 at 13:39
  • $\begingroup$ I have searched for it endlessly, but I can't seem to understand the concept perfectly. I understand the basics but I would like to know how exactly are software packages are conducting this tests. $\endgroup$ – Keshav Z Bhide Jul 23 '17 at 9:07
  • $\begingroup$ It's done by linear regression. You have a step by step explanation Here $\endgroup$ – user603 Jul 23 '17 at 9:14
1
$\begingroup$

You can for example take a look at the implementation of the urca package by typing

library(urca)
ur.df
$\endgroup$
0
$\begingroup$

I have been in the same situation as yours.

  1. As mentioned in the comments, DF or ADF works by doing a linear regression, estimated by OLS. Technically, you can do this by yourself, say using lm function in R. However, the p-values reported by this would not be appropriate as you need DF table. This table is easily available in many texts, e.g. Hamilton's Time Series Analysis. For more see this.

  2. Coming to how softwares do it: Let me take R as an example: there are many packages in R that provide ADF test: tseries::adf.test, aTSA::adf.test, fUnitRoots::adfTest, and finally urca::ur.df

All provide options to choose drift, trend, lags etc. However, only ur.df provides summary of the regression being done in the background. Good thing is that the summary of regression allows you to know what parameters are insignificant. This is extremely important if you mis-specify the ADF test. For example, if you include trend and the original process is stationary with no time trend then it may report the series to be non-stationary (I have had this problem in aTSA::adf.test).

  1. Finally, the last resort is to see the source code. This is easy in rstudio. In rstudio's Console panel or Source panel, write the function and then press F2. It opens up the source code. Hope this helps.
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.