sync_test function

Time Series Trend Synchronicity Test

Time Series Trend Synchronicity Test

Nonparametric test for synchronicity of parametric trends in multiple time series if(!exists(".Rdpack.currefs")) .Rdpack.currefs <-new.env();Rdpack::insert_citeOnly(keys="Lyubchich_Gel_2016_synchronism",package="funtimes",cached_env=.Rdpack.currefs) . The method tests whether NN observed time series exhibit the same trend of some pre-specified smooth parametric form.

sync_test( formula, B = 1000, Window = NULL, q = NULL, j = NULL, ar.order = NULL, ar.method = "HVK", ic = "BIC" )

Arguments

  • formula: an object of class "formula", specifying the form of the common parametric time trend to be tested in a TT by NN matrix of time series (time series in columns). Variable tt should be used to specify the form of the trend, where tt is specified within the function as a regular sequence on the interval (0,1]. See `Examples'.

  • B: number of bootstrap simulations to obtain empirical critical values. Default is 1000.

  • Window: scalar or NN-vector with lengths of the local windows (factors). If only one value is set, the same Window is applied to each time series. An NN-vector gives a specific window for each time series. If Window is not specified, an automatic algorithm for optimal window selection is applied as a default option (see `Details').

  • q: scalar from 0 to 1 to define the set of possible windows T*q^j

    and to automatically select an optimal window for each time series. Default is 3/43/4. This argument is ignored if the Window is set by the user.

  • j: numeric vector to define the set of possible windows T*q^j

    and to automatically select an optimal window for each time series. Default is c(8:11). This argument is ignored if the Window is set by the user.

  • ar.order: order of the autoregressive filter when ic = "none", or the maximal order for IC-based filtering. Default is round(10*log10(T)). The ar.order can be a scalar or NN-vector. If scalar, the same ar.order is applied to each time series. An NN-vector specifies a separate ar.order for each time series.

  • ar.method: method of estimating autoregression coefficients. Default "HVK" delivers robust difference-based estimates by if(!exists(".Rdpack.currefs")) .Rdpack.currefs <-new.env();Rdpack::insert_citeOnly(keys="Hall_VanKeilegom_2003;textual",package="funtimes",cached_env=.Rdpack.currefs) . Alternatively, options of ar function can be used, such as "burg", "ols", "mle", and "yw".

  • ic: information criterion used to select the order of autoregressive filter (AIC of BIC), considering models of orders p=p= 0,1,...,ar.order. If ic = "none", the AR(pp) model with p=p= ar.order is used, without order selection.

Returns

A list of class "htest" containing the following components: - method: name of the method.

  • data.name: name of the data.

  • statistic: value of the test statistic.

  • p.value: pp-value of the test.

  • alternative: alternative hypothesis.

  • estimate: list with elements common_trend_estimates, ar_order_used, Window_used, wavk_obs, and all_considered_windows. The latter is a table with bootstrap and asymptotic test results for all considered windows, that is, without adaptive selection of the local window.

Details

Arguments Window, j, and q are used to set windows for the local regression. Current version of the function assumes two options: (1) user specifies one fixed window for each time series using the argument Window (if Window is set, j and q are ignored), and (2) user specifies a set of windows by j and q to apply this set to each time series and to select an optimal window using a heuristic mm-out-of-nn subsampling algorithm if(!exists(".Rdpack.currefs")) .Rdpack.currefs <-new.env();Rdpack::insert_citeOnly(keys="Bickel_Sakov_2008",package="funtimes",cached_env=.Rdpack.currefs) . The option of selecting windows automatically for some of the time series, while for other time series the window is fixed, is not available yet. If none of these three arguments is set, default j and q are used. Values T*q^j are mapped to the largest previous integer, then only those greater than 2 are used.

See more details in if(!exists(".Rdpack.currefs")) .Rdpack.currefs <-new.env();Rdpack::insert_citeOnly(keys="Lyubchich_Gel_2016_synchronism;textual",package="funtimes",cached_env=.Rdpack.currefs)

and if(!exists(".Rdpack.currefs")) .Rdpack.currefs <-new.env();Rdpack::insert_citeOnly(keys="Lyubchich_2016_trends;textual",package="funtimes",cached_env=.Rdpack.currefs) .

Examples

#Fix seed for reproducible simulations: set.seed(1) # Simulate two autoregressive time series of length n without trend #(i.e., with zero or constant trend) # and arrange the series into a matrix: n <- 200 y1 <- arima.sim(n = n, list(order = c(1, 0, 0), ar = c(0.6))) y2 <- arima.sim(n = n, list(order = c(1, 0, 0), ar = c(-0.2))) Y <- cbind(y1, y2) plot.ts(Y) #Test H0 of a common linear trend: ## Not run: sync_test(Y ~ t, B = 500) ## End(Not run) # Sample output: ## Nonparametric test for synchronism of parametric trends ## ##data: Y ##Test statistic = -0.0028999, p-value = 0.7 ##alternative hypothesis: common trend is not of the form Y ~ t. ##sample estimates: ##$common_trend_estimates ## Estimate Std. Error t value Pr(>|t|) ##(Intercept) -0.02472566 0.1014069 -0.2438261 0.8076179 ##t 0.04920529 0.1749859 0.2811958 0.7788539 ## ##$ar.order_used ## y1 y2 ##ar.order 1 1 ## ##$Window_used ## y1 y2 ##Window 15 8 ## ##$all_considered_windows ## Window Statistic p-value Asympt. p-value ## 8 -0.000384583 0.728 0.9967082 ## 11 -0.024994408 0.860 0.7886005 ## 15 -0.047030164 0.976 0.6138976 ## 20 -0.015078579 0.668 0.8714980 ## ##$wavk_obs ##[1] 0.05827148 -0.06117136 # Add a time series y3 with a different linear trend and re-apply the test: y3 <- 1 + 3*((1:n)/n) + arima.sim(n = n, list(order = c(1, 0, 0), ar = c(-0.2))) Y2 <- cbind(Y, y3) plot.ts(Y2) ## Not run: sync_test(Y2 ~ t, B = 500) ## End(Not run) # Sample output: ## Nonparametric test for synchronism of parametric trends ## ##data: Y2 ##Test statistic = 0.48579, p-value < 2.2e-16 ##alternative hypothesis: common trend is not of the form Y2 ~ t. ##sample estimates: ##$common_trend_estimates ## Estimate Std. Error t value Pr(>|t|) ##(Intercept) -0.3632963 0.07932649 -4.57976 8.219360e-06 ##t 0.7229777 0.13688429 5.28167 3.356552e-07 ## ##$ar.order_used ## Y.y1 Y.y2 y3 ##ar.order 1 1 0 ## ##$Window_used ## Y.y1 Y.y2 y3 ##Window 8 11 8 ## ##$all_considered_windows ## Window Statistic p-value Asympt. p-value ## 8 0.4930069 0 1.207378e-05 ## 11 0.5637067 0 5.620248e-07 ## 15 0.6369703 0 1.566057e-08 ## 20 0.7431621 0 4.201484e-11 ## ##$wavk_obs ##[1] 0.08941797 -0.07985614 0.34672734 #Other hypothesized trend forms can be specified, for example: ## Not run: sync_test(Y ~ 1) #constant trend sync_test(Y ~ poly(t, 2)) #quadratic trend sync_test(Y ~ poly(t, 3)) #cubic trend ## End(Not run)

References

if(!exists(".Rdpack.currefs")) .Rdpack.currefs <-new.env();Rdpack::insert_all_ref(.Rdpack.currefs)

See Also

ar, HVK, WAVK, wavk_test

Author(s)

Yulia R. Gel, Vyacheslav Lyubchich, Ethan Schaeffer, Xingyu Wang

  • Maintainer: Vyacheslav Lyubchich
  • License: GPL (>= 2)
  • Last published: 2023-03-21

Useful links