How to determine the time series of stationarity or not using the fUnitRoots package in the R language

I have one time series, let's say

694 281 479 646 282 317 790 591 573 605 423 639 873 420 626 849 596 486 578 457 465 518 272 549 437 445 596 396 259 390

Now I want to predict the following values ​​using the ARIMA Model, but ARIMA requires the time series to be stationary, so before that I have to determine if the time series above meets the requirement or not, then fUnitRoots appears.

I think http://cran.r-project.org/web/packages/fUnitRoots/fUnitRoots.pdf may offer some help, but there is no simple tutorial

I just want one small demonstration to show how to identify one time series, is there anyone?

early.

+4
source share
2 answers

I will give an example using the urca package in R

 library(urca) data(npext) # This is the data used by Nelson and Plosser (1982) sample.data<-npext head(sample.data) year cpi employmt gnpdefl nomgnp interest indprod gnpperca realgnp wages realwag sp500 unemploy velocity M 1 1860 3.295837 NA NA NA NA -0.1053605 NA NA NA NA NA NA NA NA 2 1861 3.295837 NA NA NA NA -0.1053605 NA NA NA NA NA NA NA NA 3 1862 3.401197 NA NA NA NA -0.1053605 NA NA NA NA NA NA NA NA 4 1863 3.610918 NA NA NA NA 0.0000000 NA NA NA NA NA NA NA NA 5 1864 3.871201 NA NA NA NA 0.0000000 NA NA NA NA NA NA NA NA 6 1865 3.850148 NA NA NA NA 0.0000000 NA NA NA NA NA NA NA NA 

I will use ADF to run a unit root test on an industrial production index as an illustration. lag is selected based on SIC . I use the trend, as there is a trend in the date.

  ############################################### # Augmented Dickey-Fuller Test Unit Root Test # ############################################### Test regression trend Call: lm(formula = z.diff ~ z.lag.1 + 1 + tt + z.diff.lag) Residuals: Min 1Q Median 3Q Max -0.31644 -0.04813 0.00965 0.05252 0.20504 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 0.052208 0.017273 3.022 0.003051 ** z.lag.1 -0.176575 0.049406 -3.574 0.000503 *** tt 0.007185 0.002061 3.486 0.000680 *** z.diff.lag 0.124320 0.089153 1.394 0.165695 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 0.09252 on 123 degrees of freedom Multiple R-squared: 0.09796, Adjusted R-squared: 0.07596 F-statistic: 4.452 on 3 and 123 DF, p-value: 0.005255 Value of test-statistic is: -3.574 11.1715 6.5748 Critical values for test statistics: 1pct 5pct 10pct tau3 -3.99 -3.43 -3.13 phi2 6.22 4.75 4.07 phi3 8.43 6.49 5.47 

# Interpretation: BIC selects lag 1 as optimal lag. Test statistics of -3.574 less than the critical tau3 value at 5 percent (-3.430). So, zero, which is the unit root, deviates only at 5 percent .

Also, view the free forecasting book here.

+4
source

You can, of course, conduct formal tests, such as the ADF test, but I would suggest conducting “unofficial” tests of stationarity as a first step.

Checking visual data with plot() will help you determine if the data is motionless.

The next step will be to investigate the autocorrelation function and the partial autocorrelation function of the data. You can do this by calling the acf() and pacf() functions. This will not only help you decide whether the data will be stationary, but it will also help you identify preliminary ARIMA models that can then be evaluated and used to predict if they will be understood after the necessary diagnostic tests have been completed.

You must, indeed, be careful that the data you provide contains only 30 observations. This falls below the practical minimum level of about 50 observations required for forecasting using ARIMA models.

If that helps, a moment after I built the data, I'm pretty sure that the data was probably still. The acf and pacf estimates seem to support this view. Sometimes such unofficial tests are enough.

This little-book-of-r-for-time-series can help you further.

+1
source

All Articles