20
$\begingroup$

I'm using KPSS Method to check if the series is stationary, but I would also like to use another test to confirm if the series is stationary or not, what method coudl I use?

enter image description here

$\endgroup$
5
  • $\begingroup$ did you already do some operations on the time series? $\endgroup$
    – SRKX
    Nov 13, 2011 at 16:45
  • $\begingroup$ @SRKX what operations are you talking to? $\endgroup$
    – Dail
    Nov 14, 2011 at 7:23
  • $\begingroup$ detrending for example. $\endgroup$
    – SRKX
    Nov 14, 2011 at 8:20
  • $\begingroup$ @SRKX why do I have to detrend the series? I think unit root test already do that, no? $\endgroup$
    – Dail
    Nov 14, 2011 at 15:45
  • $\begingroup$ indeed, I was just wondering looking at your graph $\endgroup$
    – SRKX
    Nov 14, 2011 at 15:56

8 Answers 8

17
$\begingroup$

There are many different methods for this. Most people rely on a unit root test. Rmetrics has collected the most common unit root tests into the fUnitRoots package, which primarily provides a wrapper for Bernhard Pfaff's urca package. These include:

  • Augmented Dickey–Fuller (ADF) test
  • Elliott–Rothenberg–Stock test
  • KPSS unit root test
  • Phillips–Perron test
  • Schmidt–Phillips test
  • Zivot–Andrews

If you want to understand these functions in more detail, I recommend Pfaff's book on "Analysis of Integrated and Cointegrated Time Series with R". "Applied Econometrics with R" also provides a nice short introduction.

Chapter 4 of Eric Zivot's book on time series analysis covers unit root tests and is available on his website. He uses S-Plus, but the urca functions are almost identical.

$\endgroup$
1
  • $\begingroup$ thank you for the answer, but as I mentioned The series above have passed the following unit root tests: ADF, PP, ERS, KPSS... So I think is not a unit root problem, maybe I have to use some test to check if the "volatility" is constant, what do you think about that? $\endgroup$
    – Dail
    Nov 14, 2011 at 7:25
10
$\begingroup$

You can use the (Adjusted) Dickey Fuller Test: http://en.wikipedia.org/wiki/Dickey%E2%80%93Fuller_test

I'm pretty sure your software package has a library or routine you can use to do it.

$\endgroup$
12
  • $\begingroup$ yes I found it on URCA package (ur.df) I need a level stationary, what parameters should I use? because I see "none" "drift" and "trend" on the type parameter. $\endgroup$
    – Dam
    Nov 13, 2011 at 11:41
  • $\begingroup$ It's hard to be sure without seeing the data but I would go for 'none'. I advise you read the documentation at cran.r-project.org/web/packages/urca/urca.pdf , page 43 for more information about the type parameter and the lag selection. $\endgroup$
    – Bob Jansen
    Nov 13, 2011 at 12:06
  • $\begingroup$ About the data you can image that I need to use this test in a timeseries like rnorm(800) (obviously the data is not so perfect) I need a test to understand if my data is similar to it or not $\endgroup$
    – Dam
    Nov 13, 2011 at 12:08
  • $\begingroup$ Can you give us a plot? $\endgroup$
    – Bob Jansen
    Nov 13, 2011 at 12:41
  • 1
    $\begingroup$ Have you looked at this: staff.bath.ac.uk/hssjrh/Phillips%20Perron.pdf $\endgroup$
    – Bob Jansen
    Nov 13, 2011 at 17:29
6
$\begingroup$

Yet another alternative are wavelet based tests. With comparable size, they often have higher power, especially for very near unit root alternatives. An example is here (free pre-print versions of this paper are available, too).

$\endgroup$
2
  • $\begingroup$ Should it be the R package to do the tests you told me? cran.r-project.org/web/packages/wavelets/index.html $\endgroup$
    – Dail
    Nov 14, 2011 at 7:02
  • $\begingroup$ You can use the DWT and MODWT functions in that package to construct the test. I doubt the test itself is implemented. Maybe you can find the code at the authors' webpages. $\endgroup$
    – Ryogi
    Nov 14, 2011 at 16:45
3
$\begingroup$

The tseries package has GARCH models. Here is some simple code:

library(quantmod)
library(tseries)
getSymbols("MSFT")
ret <- diff.xts(log(MSFT$MSFT.Adjusted))[-1]
arch_model <- garch(ret, order=c(0, 3))
garch_model <- garch(ret, order=c(3, 3))
plot(arch_model)                                  
plot(garch_model)                                  

Also, Eric Zivot has good notes on time-series and R.

$\endgroup$
5
  • $\begingroup$ (I'm Dam, I registered an username on quant)... thank you for that example...but after plotting those example, how I solve my problem of different volatility? As far I have understand garch return an autoregressive model, so obviously there is not a kind of "pvalue" to test if the series "pass" or not. How could i do? thank you! $\endgroup$
    – Dail
    Nov 14, 2011 at 7:00
  • $\begingroup$ @ricardh: you imply fitting a GARCH, computing the local volatilities $\sigma_t$ and checking whether they are the same $\forall t$ right? $\endgroup$
    – SRKX
    Nov 14, 2011 at 13:15
  • $\begingroup$ @SKRX -- Yes, thanks. I should have included more commentary. He asked how to fit a GARCH model in R, so I gave some code. Once he determines the best-fitting GARCH model with ll, ic, and ssr, he can perform joint tests on the GARCH model coefficients. $\endgroup$ Nov 14, 2011 at 14:32
  • $\begingroup$ @richardh what tests are you referring to? (about coefficients testing) $\endgroup$
    – Dail
    Nov 14, 2011 at 15:46
  • $\begingroup$ @Dail -- There are a variety of tests, but Wald tests that all coefficients are jointly zero is probably the easiest. I searched for how to do this in R, but wasn't too successful. You will likely have to grab a text book and code the tests yourself. (I switched to Stata for most analyses because hypothesis testing is so much easier). $\endgroup$ Nov 14, 2011 at 16:26
1
$\begingroup$

Divide the time series into two sections (e.g. 1st half and 2nd half) and construct the CDF for each part. The CDFs should be the same if the series is stationary. Since the CDFs will never be exactly the same you can apply Pearson's $\chi^{2}$ test comparing the value of the CDFs through several waypoints. I believe this test was created by the late Cliff Sherry.

$\endgroup$
1
$\begingroup$

If your theory/common sense indicates that your series is stationary the KPSS test is appropriate. It is a test of your theory/common sense.

If your theory/common sense indicates that your series is I(1) then you should use one of the unit root tests already mentioned. I would prefer the Elliott–Rothenberg–Stock test.

I would not recommend doing both tests. If they both confirm your original ideas then you are OK. If you are assuming stationarity and your series passes the KPSS test but the unit root test indicates non stationarity I would still accept that my theory has been confirmed by the KPSS and proceed accordingly. If the KPSS indicates non-stationarity and this is confirmed by the unit root test then my theory/common sense is subject to query. In any of the three cases there is no benefit to be gained from doing both kinds of tests.

Without a knowledge of what you are testing it is not possible to give more specific advice.

If you are estimating an ARMA or GARCH process the estimated coefficients must satisfy certain conditions if the series is to be stationary

$\endgroup$
1
$\begingroup$

You can use ADF test as implemented in R in different packages However, accuracy and power of these implementations would differ, since, these tests refer different papers to generate the p-values. The table below contains the packages, name of the functions and the referenced papers. You can go through the papers to keep an eye on the differences in the implementations. enter image description here

$\endgroup$
-2
$\begingroup$

To be a stationarity is when the roots of charateristic equation lies outside of the unit circle.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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