sync_test: Time Series Trend Synchronism Test

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/sync_test.R

Description

Non-parametric test for synchronism of parametric trends in multiple time series \insertCiteLyubchich_Gel_2016_synchronismfuntimes. The method tests whether N observed time series exhibit the same trend of some pre-specified smooth parametric form.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
sync_test(
  formula,
  B = 1000,
  Window = NULL,
  q = NULL,
  j = NULL,
  ar.order = NULL,
  ar.method = "HVK",
  BIC = TRUE
)

Arguments

formula

an object of class "formula", specifying the form of the common parametric time trend to be tested in a T by N matrix of time series (time series in columns). Variable t should be used to specify the form of the trend, where t 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 N-vector with lengths of the local windows (factors). If only one value is set, the same Window is applied to each time series. An N-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/4. This argument is ignored if Window is set by 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 Window is set by user.

ar.order

order of autoregressive filter when BIC = FALSE, or the maximal order for BIC-based filtering. Default is round(10*log10(T)). The ar.order can be a scalar or N-vector. If scalar, the same ar.order is applied to each time series. An N-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 \insertCiteHall_VanKeilegom_2003;textualfuntimes. Alternatively, options of ar function can be used, such as "burg", "ols", "mle", and "yw".

BIC

logical value indicates whether the order of autoregressive filter should be selected by Bayesian information criterion (BIC). If TRUE (default), models of orders p= 0,1,...,ar.order or p= 0,1,...,round(10*log10(length(x))) are considered, depending on whether ar.order is defined or not (x is the time series).

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 m-out-of-n subsampling algorithm \insertCiteBickel_Sakov_2008funtimes. 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 \insertCiteLyubchich_Gel_2016_synchronism;textualfuntimes and \insertCiteLyubchich_2016_trends;textualfuntimes.

Value

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

p-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.

Author(s)

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

References

\insertAllCited

See Also

ar, HVK, WAVK, wavk_test

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
#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:
##	Non-parametric 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:
##	Non-parametric 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)

funtimes documentation built on Nov. 28, 2020, 1:06 a.m.