Learn R Programming

funtimes (version 6.1)

notrend.test: Sieve Bootstrap Based Test for the Null Hypothesis of no Trend

Description

A combination of time series trend tests for testing the null hypothesis of no trend, versus the alternative hypothesis of a linear trend (Student's t-test), or monotonic trend (Mann-Kendall test), or more general, possibly non-monotonic trend (WAVK test).

Usage

notrend.test(x, B = 1000, test = c("t", "MK", "WAVK"),
  ar.method = "HVK", ar.order = NULL, BIC = TRUE,
  factor.length = c("user.defined", "adaptive.selection"),
  Window = NULL, q = 3/4, j = c(8:11))

Arguments

x

a vector containing a univariate time series. Missing values are not allowed.

B

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

test

trend test to implement: Student's t-test ("t", default), Mann-Kendall test ("MK"), or WAVK test ("WAVK", see WAVK).

ar.method

method of estimating autoregression coefficients. Default "HVK" delivers robust difference-based estimates by Hall_VanKeilegom_2003;textualfuntimes. Alternatively, options of ar function can be used, such as "burg", "ols", "mle", and "yw".

ar.order

order of autoregressive model when BIC = FALSE, or the maximal order for BIC-based filtering. Default is round(10*log10(length(x))), where x is the time series.

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

factor.length

method to define the length of local windows (factors). Used only if test = "WAVK". Default option "user.defined" allows to set only one value of the argument Window. The option "adaptive.selection" sets method = "boot" and employs heuristic \(m\)-out-of-\(n\) subsampling algorithm Bickel_Sakov_2008funtimes to select an optimal window from the set of possible windows length(x)*q^j whose values are mapped to the largest previous integer and greater than 2. Vector x is the time series tested.

Window

length of the local window (factor), default is round(0.1*length(x)). Used only if test = "WAVK". This argument is ignored if factor.length = "adaptive.selection".

q

scalar from 0 to 1 to define the set of possible windows when factor.length = "adaptive.selection". Used only if test = "WAVK". Default is \(3/4\). This argument is ignored if factor.length = "user.defined".

j

numeric vector to define the set of possible windows when factor.length = "adaptive.selection". Used only if test = "WAVK". Default is c(8:11). This argument is ignored if factor.length = "user.defined".

Value

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

\(p\)-value of the test.

alternative

alternative hypothesis.

estimate

list with the following elements: employed AR order and estimated AR coefficients.

parameter

window that was used in WAVK test, included in the output only if test = "WAVK".

Details

This function tests the null hypothesis of no trend versus different alternatives. To set some other shape of trend as the null hypothesis, use wavk.test. Note that wavk.test employs hybrid bootstrap, which is alternative to the sieve bootstrap employed by the current function.

References

See Also

ar, HVK, WAVK, wavk.test

Examples

Run this code
# NOT RUN {
# Fix seed for reproducible simulations:
set.seed(1)

#Simulate autoregressive time series of length n with smooth linear trend:
n <- 200
tsTrend <- 1 + 2*(1:n/n)
tsNoise <- arima.sim(n = n, list(order = c(2, 0, 0), ar = c(0.5, -0.1)))
U <- tsTrend + tsNoise
plot.ts(U)
    
#Use t-test
notrend.test(U)
    
#Use Mann-Kendall test and Yule-Walker estimates of the AR parameters
notrend.test(U, test = "MK", ar.method = "yw")
    
#Use WAVK test for the H0 of no trend, with m-out-of-n selection of the local window:
notrend.test(U, test = "WAVK", factor.length = "adaptive.selection")
# Sample output:
##	Sieve-bootstrap WAVK trend test
##
##data:  U
##WAVK test statistic = 21.654, moving window = 15, p-value < 2.2e-16
##alternative hypothesis: (non-)monotonic trend.
##sample estimates:
##$AR_order
##[1] 1
##
##$AR_coefficients
##    phi_1 
##0.4041848 
# }
# NOT RUN {
# }

Run the code above in your browser using DataLab