UnitrootTests            package:fSeries            R Documentation

_U_n_i_t _R_o_o_t _a_n_d _C_o_i_n_t_e_g_r_a_t_i_o_n _T_i_m_e _S_e_r_i_e_s _T_e_s_t_s

_D_e_s_c_r_i_p_t_i_o_n:

     A collection and description of functions for unit root testing.
     The family of tests includes ADF tests based on Banerjee's et al.
     tables and on J.G. McKinnons' numerical distribution functions. In
     addition we have included functions from the contributed R package
     'tseries' written by Adrian Trapletti and from the package 'urca'
     written by Bernhard Pfaff. 

     The functions are:

       'adfTest'       Augmented Dickey-Fuller test for unit roots,
       'unitrootTest'  the same based on McKinnons's test statistics.

     Added functions based on the 'tseries' package include:

       'tsadfTest'   Augmented Dickey-Fuller test for unit roots,
       'tskpssTest'  KPSS test for level or trend stationarity,
       'tsppTest'    Phillips-Perron test for unit roots,
       'tspoTest'    Phillips-Ouliaris test for cointegration.

     Added functions based on the 'urca' package include:

       'urersTest'   Elliott-Rothenberg-Stock test for unit roots,
       'urkpssTest'  KPSS unit root test for stationarity,
       'urppTest'    Phillips-Perron test for unit roots,
       'urspTest'    Schmidt-Phillips test for unit roots,
       'urzaTest'    Zivot-Andrews test for unit roots.

     NOTE: The contributed R packages 'tseries' and 'urca' are not
     required, the functions are builtin.

_U_s_a_g_e:

     urTest(x, method = c("unitroot", "adf", "tsadf", "tskpss", "tspp", 
             "urers", "urkpss", "urpp", "ursp", "urza"), title = NULL, 
             description = NULL, ...)

     adfTest(x, type = c("nc", "c", "ct"), lags = 1)
     unitrootTest(x, trend = c("nc", "c", "ct"), statistic = c("t", "n"), 
             method = "adf", lags = 1)

     tsadfTest(x, alternative = c("stationary", "explosive"), 
             k = trunc((length(x)-1)^(1/3)))
     tskpssTest(x, nullhyp = c("level", "trend"), lshort = TRUE) 
     tsppTest(x, alternative = c("stationary", "explosive"), 
             type = c("Z(alpha)", "Z(t_alpha)"), lshort = TRUE)
     tspoTest(x, demean = TRUE, lshort = TRUE)

     urersTest(x, type = c("DF-GLS", "P-test"), model = c("constant", "trend"),
             lag.max = 4)
     urkpssTest(x, type = c("mu", "tau"), lags = c("short", "long", "nil"),
         use.lag = NULL)
     urppTest(x, type = c("Z-alpha", "Z-tau"), model = c("constant", "trend"),
             lags = c("short", "long"))
     urspTest(x, type = c("tau", "rho"), pol.deg = c(1, 2, 3, 4),
             signif = c(0.01, 0.05, 0.1))
     urzaTest(x, model = c("intercept", "trend", "both"), lag)

     ## S3 method for class 'fURTEST':
     print(x, ...)
     ## S3 method for class 'fURTEST':
     summary(object, ...)

_A_r_g_u_m_e_n_t_s:

alternative: [tsadfTest] - 
           the argument indicates an alternative hypothesis. The choice
           must be one of the elements specified in the input vector,
          by  default the first entry is selected. 
           [tsppTest] - 
           indicates the alternative hypothesis and must be one of 
          '"stationary"', the default, or '"explosive"'.  One can
          specify just the initial letter. 

  demean: [tspoTest] - 
           a logical indicating whether an intercept is included in the
           cointegration regression or not. 

description: a character string which allows for a brief description. 

       k: [tsadfTest] - 
           the lag order to calculate the test statistic. 

 lag.max: [urersTest] - 
           the maximum numbers of lags used for testing of a decent lag
           truncation for the '"P-test"', BIC used, or the maximum 
          number of lagged differences to be included in the test 
          regression for '"DF-GLS"'. 

     lag: [urzaTest] - 
           the highest number of lagged endogenous differenced
          variables  to be included in the test regression. 

    lags: [urkpssTest][urppTest] - 
           the maximum number of lags used for error term correction. 

  lshort: [tsppTest] - 
           a logical indicating whether the short or long version of
          the  truncation lag parameter is used. 
           [tspoTest] - 
           a logical indicating whether the short or long version of
          the  truncation lag parameter is used. 

  method: [urTest] - 
           a character string describing the desired method, one of:
          '"unitroot"', '"adf"', '"tsadf"', '"tskpss"',  '"tspp"',
          '"urers"', '"urkpss"', '"urpp"',  '"ursp"', '"urza"', or
          '"W3SLS"'. 
           [unitrootTest] - 
           a character string specifying the method of the test. Valid 
          choices are '"adf"' for the augmented Dickey-Fuller test, 
          and '"pp"' for Phillips-Perron test. The default is  '"adf"'.            

   model: [urersTest] - 
           a character string dennoting the deterministic model used
          for  detrending, either '"constant"', the default, or 
          '"trend"'. 
           [urppTest] - 
           a character string which determines the deterministic part
          in  the test regression, either '"constant"', the default, or
           '"trend"'. 
           [urzaTest] - 
           a character string specifying if the potential break occured
           in either the '"intercept"', the linear '"trend"' or  in
          '"both"'. 

 nullhyp: [tskpssTest] - 
           a character string which indicates the null hypothesis and
          must  be one of  '"level"' (default) or '"trend"'. One can 
          specify just the initial letter. 

  object: an object of class '"fURTEST"'. 

 pol.deg: [urspTest] - 
           the polynomial degree in the test regression. 

  signif: [urspTest] - 
           the significance level for the critical value of the test 
          statistic. 

statistic: [unitrootTest] - 
           a character string specifying the test statistic. Valid
          choices  are  '"t"' for the t-statistic, the default, and
          '"n"'  for the normalized statistic, sometimes also referred
          to as  the rho-statistic.  

   title: a character string which allows for a project title. 

   trend: [unitrootTest] - 
           a character string describing the type of the unit root 
          regression. Valid choices are '"nc"' for a regression  with
          no intercept (constant) nor time trend, and '"c"'  for a
          regression with an intercept (constant) but no time  trend,
          '"ct"' for a regression with an intercept  (constant) and a
          time trend. The default is '"c"'.  

    type: [tsppTest] - 
           indicates which variant of a test will be computed. The
          choice  must be one of the elements specified in the input
          vector, by  default the first entry is selected. 
           [urkpssTest] - 
           a character string which denotes the type of deterministic
          part, either '"mu"', the default, or '"tau"'. [urppTest] - 
           a character string which specifies the test type, either 
          '"Z-alpha"', the default, or '"Z-tau"'. [urspTest] - 
           a character string which specifies the test type, either 
          '"tau"', the default, or '"rho"'. 

 use.lag: [urkpssTest] - 
           a character string specifying the number of lags. Allowed
          arguments are 'lags=c("short", "long", "nil")', for more 
          information see the details section. 

       x: a numeric vector or time series object. 

     ...: [urTest] - 
           optional arguments passed to the underlying test functions. 

_D_e_t_a_i_l_s:

     *ADF Tests:*

     The 'adftest' computes test statistics and p values using the
     implementation from Trapletti's augmented Dickey-Fuller test  for
     unit roots, see below. In contrast to the function  'tsadfTest'
     three kind of test types can be selected. 

     *Unit Root Tests from Adrian Trapletti's "tseries" Package:* 

     _Augmented Dickey-Fuller Test for Unit Roots:_ 
      The general regression equation which incorporates a constant and
     a linear trend is used and the t-statistic for a first order
     autoregressive coefficient equals one is computed. The number of
     lags used in the regression is 'k'. The default value of
     'trunc((length(x)-1)^(1/3))' corresponds to the suggested upper
     bound on the rate at which the number of lags, 'k', should be made
     to grow with the sample size for the general 'ARMA(p,q)' setup.
     Note that for 'k' equals zero the standard Dickey-Fuller test is
     computed. The p-values are interpolated from Table 4.2, p. 103 of
     Banerjee et al. (1993). If the computed statistic is outside the
     table of critical values, then a warning message is generated. 
     Note, that missing values are not allowed. 
      '[tseries:adf.test]' 

     _Kwiatkowski-Phillips-Schmidt-Shin Test:_  
      To estimate 'sigma^2' the Newey-West estimator is used. If
     'lshort' is 'TRUE', then the truncation lag parameter is set to
     'trunc(3*sqrt(n)/13)', otherwise 'trunc(10*sqrt(n)/14)' is used. 
     The p-values are interpolated from Table 1 of Kwiatkowski et al.
     (1992). If the computed statistic is outside the table of critical
     values, then a warning message is generated. 
      '[tseries:kpss.test]' 

     _Phillips-Ouliaris Test:_  
      The 'poTest' Z(alpha) statistic for a unit root in the residuals
     of the cointegration regression is computed, see also 'ppTest'.
     The unit root is estimated from a regression of the first variable
     (column) of 'x' on the remaining variables of 'x' without a
     constant and a linear trend.  To estimate 'sigma^2' the Newey-West
     estimator is used.  If 'lshort' is 'TRUE', then the truncation lag
     parameter is set to 'trunc(n/100)', otherwise 'trunc(n/30)' is
     used.  The p-values are interpolated from Table Ia and Ib, p. 189
     of Phillips and Ouliaris (1990).  If the computed statistic is
     outside the table of critical values, then a warning message is
     generated. The dimension  of 'x' is restricted to six variables. 
      '[tseries:po.test]' 


     _Phillips-Perron Test:_  
           The general regression equation which incorporates a
     constant and a linear trend is used and the 'Z(alpha)' or
     'Z(t_alpha)' statistic for a first order autoregressive
     coefficient equals one are computed.  To estimate 'sigma^2' the
     Newey-West estimator is used.  If 'lshort' is 'TRUE', then the
     truncation lag parameter is set to 'trunc(4*(n/100)^0.25)',
     otherwise 'trunc(12*(n/100)^0.25)' is used.  The p-values are
     interpolated from Table 4.1 and 4.2, p. 103 of Banerjee et al.
     (1993). If the computed statistic is outside the table of critical
     values, then a warning message is generated. 
      '[tseries:pp.test]' 

     *Unit Root Tests from Berhard Pfaff's "urca" Package:* 

     _Elliott-Rothenberg-Stock Test for Unit Roots:_  
      To improve the power of the unit root test, Elliot, Rothenberg
     and  Stock proposed a local to unity detrending of the time
     series. ERS  developed a feasible point optimal test, '"P-test"',
     which  takes serial correlation of the error term into account.
     The second  test type is the '"DF-GLS"' test, which is an ADF-type
     test  applied to the detrended data without intercept. Critical
     values  for this test are taken from MacKinnon in case of
     'model="constant"' and else from Table 1 of Elliot, Rothenberg and
     Stock. 
      '[urca:ur.ers]' 

     _KPSS Test for Unit Roots:_  
      Performs the KPSS unit root test, where the Null hypothesis is 
     stationarity. The test types specify as deterministic component 
     either a constant '"mu"' or a constant with linear trend  '"tau"'.
     'lags="short"' sets the number of lags to  _root 4 of [4 times
     (n/100)_, whereas 'lags="long"'  sets the number of lags to _root
     4 of [12 times (n/100)]_.  If 'lags="nil"' is choosen, then no
     error correction is made.  Furthermore, one can specify a
     different number of maximum lags  by setting use.lag accordingly. 
      '[urca:ur.kpss]' 

     _Phillips-Perron Test for Unit Roots:_  
      Performs the Phillips and Perron unit root test. Beside the  Z
     statistics Z-alpha and Z-tau, the Z statistics for the 
     deterministic part of the test regression are computed, too.  For
     correction of the error term a Bartlett window is used. 
      '[urca:ur.pp]' 

     _Schmidt-Phillips Test for Unit Roots:_  
      Performs the Schmidt and Phillips unit root test, where under 
     the Null and Alternative Hypothesis the coefficients of the 
     deterministic variables are included. Two test types are
     available:  the '"rho-test"' and the '"tau-test"'. Both tests are 
     extracted from the LM principle. 
      '[urca:ur.sp]' 

     _Zivot-Andrews Test for Unit Roots:_  
      Performs the Zivot and Andrews unit root test, which allows a 
     break at an unknown point in either the intercept, the linear 
     trend or in both. This test is based upon the recursive estimation
      of a test regression. The test statistic is defined as the 
     minimum t-statistic of the coeffcient of the lagged endogenous 
     variable. 
      '[urca:ur.za]'

_V_a_l_u_e:

     All tests return an object of class '"fURTEST"' with the following
     slots:

   @call: the function call.               

   @data: a data frame with the input data. 

@data.name: a character string giving the name of the data. 

   @test: a list object which holds the output of the underlying test
          function, usually the same entries as an object of class
          '"htest"'. 

  @title: a character string with the name of the test. 

@description: a character string with a brief description of the test. 

$statistic: the value of the test statistic. 

$parameter: the lag order. 

$p.value: the p-value of the test. 

 $method: a character string indicating what type of test was
          performed. 

$data.name: a character string giving the name of the data. 

$alternative: a character string describing the alternative hypothesis. 

_N_o_t_e:

     The output of the various hypothesis tests is an object of class
     'fURTEST'. The associated 'print' method gives an unique  report
     about the test results for all tests.

_A_u_t_h_o_r(_s):

     Adrian Trapletti for the tests from R's "tseries" package,
      Bernhard Pfaff for the tests from R's "urca" package,
      Diethelm Wuertz for the Rmetrics R-port.

_R_e_f_e_r_e_n_c_e_s:

     Banerjee A., Dolado J.J., Galbraith J.W., Hendry D.F. (1993);
     _Cointegration, Error Correction, and the Econometric  Analysis of
     Non-Stationary Data_, Oxford University Press, Oxford. 

     Dickey, D.A., Fuller, W.A. (1979); _Distribution of the estimators
     for autoregressive time  series with a unit root_,  Journal of the
     American Statistical Association 74, 427-431. 

     Kwiatkowski D., Phillips P.C.B, Schmidt P., Shin Y. (1992);
     _Testing the Null Hypothesis of Stationarity against  the
     Alternative of a Unit Root_, Journal of Econometrics 54, 159-178.

     MacKinnon, J.G. (1996); _Numerical distribution functions for unit
     root and  cointegration tests_, Journal of Applied Econometrics
     11, 601-618.

     Perron P. (1988); _Trends and Random Walks in Macroeconomic Time
     Series_, Journal of Economic Dynamics and Control 12, 297-332.

     Phillips P.C.B., Ouliaris S. (1990); _Asymptotic Properties of
     Residual Based Tests for Cointegration_, Econometrica 58, 165-193.

     Phillips P.C.B., Perron P. (1988); _Testing for a unit root in
     time series regression_,  Biometrika 75, 335-346.

     Said S.E., Dickey D.A. (1984); _Testing for Unit Roots in
     Autoregressive-Moving Average  Models of Unknown Order_,
     Biometrika 71, 599-607.

     Schwert G.W. (1989); _Tests for Unit Roots: A Monte Carlo
     Investigation_, Journal of Business and Economic Statistics 2,
     147-159.

_S_e_e _A_l_s_o:

     Fur further details we refer to the manual pages of the  '"urca"'
     package.

     'classicalTests', 'tseriesTests', 'lmTests'.

_E_x_a_m_p_l_e_s:

     ## Unit Root Tests build on Adrian Trapletti's Implementation:

     ## tsadfTest - 
        xmpSeries("\nStart: Augmented Dickey-Fuller Test for Unit Roots >")
        # A time series which contains no unit-root:
        x = rnorm(1000)  
        tsadfTest(x)
        # A time series which contains a unit-root:
        y = diffinv(x)
        tsadfTest(y)

     ## tskpssTest -
        xmpSeries("\nNext: KPSS test for Level or Trend Stationary >")
        # Time Series is Level Stationary:
        x = rnorm(1000)
        tskpssTest(x)
        # Time Series has Unit Root:
        tskpssTest(cumsum(x))
        # Time Series is Trend Stationary:
        x = 0.3*(1:1000) + rnorm(1000)
        tskpssTest(x, nullhyp = "trend")
        
     ## tspoTest -
        xmpSeries("\nNext: Phillips-Ouliaris Test for Cointegration >")
        # Non-Cointegrated Case:
        x = ts(diffinv(matrix(rnorm(2000), 1000, 2)))
        tspoTest(x)
        # Cointegrated Case:
        x = diffinv(rnorm(1000))
        y = 2.0 - 3.0 * x + rnorm(x, sd = 5)
        z = ts(cbind(x, y))
        tspoTest(z)
        
     ## tsppTest -
        xmpSeries("\nNext: Phillips-Perron Test for Unit Roots >")
        # The Time Series has no Unit Root:
        x = rnorm(1000)
        tsppTest(x)
        # The Time Series has Unit Root:
        y = cumsum(x)  
        tsppTest(y)     
      
     ## Unit Root Tests build on Bernhard Pfaff's Implementation:
         
     ## ur*Test - 
        # Examples can be found in the demo file "xmpTestUnitRoots".  

