notrend_test | R Documentation |
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).
notrend_test(
x,
B = 1000,
test = c("t", "MK", "WAVK"),
ar.method = "HVK",
ar.order = NULL,
ic = "BIC",
factor.length = c("user.defined", "adaptive.selection"),
Window = NULL,
q = 3/4,
j = c(8:11)
)
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 ( |
ar.method |
method of estimating autoregression coefficients.
Default |
ar.order |
order of the autoregressive model when |
ic |
information criterion used to select the order of autoregressive filter (AIC of BIC),
considering models of orders |
factor.length |
method to define the length of local windows (factors).
Used only if |
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
|
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 an alternative
to the sieve bootstrap employed by the current function.
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. |
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 |
Vyacheslav Lyubchich
ar
, HVK
, WAVK
,
wavk_test
, vignette("trendtests", package = "funtimes")
## 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
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.