TseriesTests             package:fSeries             R Documentation

_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 testing various 
     aspects of time series, including independence, normality of  the
     distribution, and neglected nonlinearities. 

     The family of time series tests includes the following  hypothesis
     tests:

       'bdsTest'  Brock-Dechert-Scheinkman test for iid series,
       'jbTest'   Jarque-Bera Test for normality,
       'tnnTest'  Teraesvirta NN test for neglected nonlinearity,
       'wnnTest'  White NN test for neglected nonlinearity.

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

     bdsTest(x, m = 3, eps = seq(0.5*sd(x), 2*sd(x), length = 4), trace = FALSE)
     jbTest(x)
     tnnTest(x, lag = 1, type = c("Chisq", "F"), scale = TRUE, ...) 
     wnnTest(x, lag = 1, qstar = 2, q = 10, range = 4, 
             type = c("Chisq", "F"), scale = TRUE, ...) 

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

     eps: a numeric vector of epsilon values for close points. The BDS
          test is computed for each element of 'eps'. It should  be set
          in terms of the standard deviation of 'x'. 

     lag: an integer which specifies the model order in terms of lags. 

       m: an integer indicating that the BDS test statistic is computed
          for embedding dimensions '2', ..., 'm'. 

       q: an integer representing the number of phantom hidden units
          used to compute the test statistic. 

   qstar: the test is conducted using 'qstar' principal components of
          the phantom hidden units. The first principal component is
          omitted since in most cases it appears to be collinear with
          the input vector of lagged variables. This strategy preserves
          power while still conserving degrees of freedom. 

   range: the input to hidden unit weights are initialized uniformly
          over '[-range/2, range/2]'. 

   scale: a logical indicating whether the data should be scaled 
          before computing the test statistic. The default arguments to
          'scale' are used. 

   trace: a logical indicating whether some informational output is
          traced. 

    type: 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. 

       x: a numeric vector or time series. 

     ...: further arguments to be passed from or to methods. 

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

     *Brock-Dechert-Sheinkman Test:* 

      The 'bdsTest' test examines the _spatial dependence_ of the 
     observed series. To do this, the series is embedded in 'm'-space 
     and the dependence of 'x' is examined by counting _near_  points.
     Points for which the distance is less than 'eps' are  called near.
     The BDS test statistic is asymptotically standard Normal. Note,
     that missing values are not allowed. There is a special print
     method for objects of class '"bdsTest"' which by default uses 4
     digits to format real numbers.  
      '[tseries:bds.test]' 

     *Jarque-Bera Test:* 

      The 'jbTest' evaluates the hypothesis that the series has a 
     normal distribution with unspecified mean and variance, against
     the  alternative that the series does not have a normal
     distribution. The  test is based on the sample skewness and
     kurtosis. For a true normal  distribution, the sample skewness
     should be near 0 and the sample  kurtosis should be near 3. The
     Jarque-Bera test determines whether  the sample skewness and
     kurtosis are unusually different than their  expected values, as
     measured by a chi-square statistic. The Jarque-Bera  test is an
     asymptotic test, and should not be used with small samples.  You
     may want to use the 'lillieTest' for small samples.  
      '[jb.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]' 

     *Teraesvirta Neural Network Test:* 

        The null is the hypotheses of linearity in 'mean'. This test 
     uses a Taylor series expansion of the activation function to 
     arrive at a suitable test statistic. If 'type' equals '"F"',  then
     the F-statistic instead of the Chi-Squared statistic is used in
     analogy to the classical linear regression.  Missing values are
     not allowed.  
       '[tseries:teraesvirta.test]' 

     *White Neural Network Test:* 

      The null is the hypotheses of linearity in ``mean''. This type of
     test is consistent against arbitrary nonlinearity in mean. If
     'type' equals '"F"', then the F-statistic instead of the
     Chi-Squared statistic is used in analogy to the classical linear
     regression.  
      '[tseries:white.test]'

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

     A list with class '"htest"' containing the following  components:

$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:

     There is nothing really new in this package.  The benefit you will
     get from this help page, that we bring together a collection of
     time series tests from several R-packages  which may be of
     interest for economists and financial engineers.

     On the other hand the user can still use the underlying function
     calls from the imported R-packages.

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

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

     Adrian Trapletti for the tests from R's tseries package,
      Blake LeBaron for the 'bds' C program,
       Diethelm Wuertz for the Rmetrics R-port.

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

     Brock, W.A., Dechert W.D., Sheinkman J.A. (1987);  _A Test of
     Independence Based on the Correlation  Dimension_,  SSRI no. 8702,
     Department of Economics, University of  Wisconsin, Madison.

     Conover, W.J. (1980); _Practical Nonparametric Statistics_,  New
     York, Wiley. 

     Cromwell J.B., Labys W.C., Terraza M. (1994); _Univariate Tests
     for Time Series Models_, Sage, Thousand Oaks, CA, pages 32-36.

     Lee T.H., White H., Granger C.W.J. (1993);  _Testing for neglected
     nonlinearity in time series models_, Journal of Econometrics 56,
     269-290.

     Teraesvirta T., Lin C.F., Granger C.W.J. (1993); _Power of the
     Neural Network Linearity Test_, Journal of Time Series Analysis
     14, 209-220.

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

     'classicalTests', 'regressionTests'.

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

     ## bdsTest -
        xmpSeries("\nNext: Brock-Dechert-Sheinkman Test for iid Series >")
        # iid Time Series:
        par(mfrow = c(3,1))
        x = rnorm(100)
        plot(x, type = "l", main = "iid Time Series")
        bdsTest(x, m = 3)
        # Non Identically Distributed Time Series:
        x = c(rnorm(50), runif(50))
        plot(x, type = "l", main = "Non-iid Time Series")
        bdsTest(x, m = 3)  
        # Non Independent Innovations from Quadratic Map:
        x = rep(0.2, 100)
        for (i in 2:100) x[i] = 4*(1-x[i-1])*x[i-1]
        plot(x, type = "l", main = "Quadratic Map")
        bdsTest(x, m = 3)
        
     ## jbTest -
        xmpSeries("\nNext: Jarque-Bera Test for Normality >")
        # Null:
        x = rnorm(100)
        jbTest(x)
        # Alternative:
        x = runif(100)
        jbTest(x)
        
     ## tnnTest -
        xmpSeries("\nNext: Teraesvirta NN test for Neglected Nonlinearity >")
        # Time Series Non-linear in ``mean'' regression 
        par(mfrow = c(2, 1))
        n = 1000
        x = runif(1000, -1, 1)  
        tnnTest(x)
        # Generate time series which is nonlinear in ``mean''
        x[1] = 0.0
        for (i in (2:n)) {
          x[i] = 0.4*x[i-1] + tanh(x[i-1]) + rnorm (1, sd = 0.5) }
        plot(x, main = "Teraesvirta Test", type = "l")
        tnnTest(x)
        
     ## wnnTest -
        xmpSeries("\nNext: White NN test for Neglected Nonlinearity >")
        # Time Series Non-Linear in ``mean'' Regression
        par(mfrow = c(2, 1))
        n = 1000
        x = runif(1000, -1, 1)
        wnnTest(x)
        # Generate time series which is nonlinear in ``mean''
        x[1] = 0.0
        for (i in (2:n)) {
          x[i] = 0.4*x[i-1] + tanh(x[i-1]) + rnorm (1, sd = 0.5) }
        plot(x, main = "White Test", type = "l")
        wnnTest(x)                     

