wavk_test | R Documentation |
Nonparametric test to detect (non-)monotonic parametric trends in time series \insertCite@based on @Lyubchich_etal_2013_wavkfuntimes.
wavk_test(
formula,
factor.length = c("user.defined", "adaptive.selection"),
Window = NULL,
q = 3/4,
j = c(8:11),
B = 1000,
method = c("boot", "asympt"),
ar.order = NULL,
ar.method = "HVK",
ic = "BIC",
out = FALSE
)
formula |
an object of class " |
factor.length |
method to define the length of local windows (factors).
Default option |
Window |
length of the local window (factor), default is
|
q |
scalar from 0 to 1 to define the set of possible windows when
|
j |
numeric vector to define the set of possible windows when
|
B |
number of bootstrap simulations to obtain empirical critical values. Default is 1000. |
method |
method of obtaining critical values: from asymptotical ( |
ar.order |
order of the autoregressive model when |
ar.method |
method of estimating autoregression coefficients.
Default |
ic |
information criterion used to select the order of autoregressive filter (AIC of BIC),
considering models of orders |
out |
logical value indicates whether the full output should be shown.
Default is |
See more details in \insertCiteLyubchich_Gel_2016_synchronism;textualfuntimes and \insertCiteLyubchich_2016_trends;textualfuntimes.
A list with 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 |
|
alternative |
alternative hypothesis. |
parameter |
window that was used. |
estimate |
list with the following elements: estimated trend coefficients;
user-defined or IC-selected AR order; estimated AR coefficients; and,
if |
Yulia R. Gel, Vyacheslav Lyubchich, Ethan Schaeffer
ar
, HVK
, WAVK
,
sync_test
, vignette("trendtests", package = "funtimes")
# Fix seed for reproducible simulations:
set.seed(1)
#Simulate autoregressive time series of length n with smooth quadratic trend:
n <- 100
tsTrend <- 1 + 2*(1:n/n) + 4*(1:n/n)^2
tsNoise <- arima.sim(n = n, list(order = c(2, 0, 0), ar = c(-0.7, -0.1)))
U <- tsTrend + tsNoise
plot.ts(U)
#Test H0 of a linear trend, with m-out-of-n selection of the local window:
## Not run:
wavk_test(U ~ t, factor.length = "adaptive.selection")
## End(Not run)
# Sample output:
## Trend test by Wang, Akritas, and Van Keilegom (bootstrap p-values)
##
##data: U
##WAVK test statistic = 5.3964, adaptively selected window = 4, p-value < 2.2e-16
##alternative hypothesis: trend is not of the form U ~ t.
#Test H0 of a quadratic trend, with m-out-of-n selection of the local window
#and output of all results:
## Not run:
wavk_test(U ~ poly(t, 2), factor.length = "adaptive.selection", out = TRUE)
## End(Not run)
# Sample output:
## Trend test by Wang, Akritas, and Van Keilegom (bootstrap p-values)
##
##data: U
##WAVK test statistic = 0.40083, adaptively selected window = 4, p-value = 0.576
##alternative hypothesis: trend is not of the form U ~ poly(t, 2).
##sample estimates:
##$trend_coefficients
##(Intercept) poly(t, 2)1 poly(t, 2)2
## 3.408530 17.681422 2.597213
##
##$AR_order
##[1] 1
##
##$AR_coefficients
## phi_1
##[1] -0.7406163
##
##$all_considered_windows
## Window WAVK-statistic p-value
## 4 0.40083181 0.576
## 5 0.06098625 0.760
## 7 -0.57115451 0.738
## 10 -1.02982929 0.360
# Test H0 of no trend (constant trend) using asymptotic distribution of statistic.
wavk_test(U ~ 1, method = "asympt")
# Sample output:
## Trend test by Wang, Akritas, and Van Keilegom (asymptotic p-values)
##
##data: U
##WAVK test statistic = 25.999, user-defined window = 10, p-value < 2.2e-16
##alternative hypothesis: trend is not of the form U ~ 1.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.