hwtos2 {locits} | R Documentation |
Test of second-order stationarity using wavelets.
Description
The main function to perform a test of second-order stationarity as outlined in Nason (2012). Essentially, this routine computes an evolutionary wavelet spectral estimate and then computes the Haar wavelet coefficients of each scale of the spectral estimate. Any large Haar coefficients are indicative of nonstationarity. A multiple hypothesis test assesses whether any of the Haar coefficients are large enough to reject the null hypothesis of stationarity.
Usage
hwtos2(x, alpha = 0.05, filter.number = 1, family = "DaubExPhase",
lowlev = 3, WTscale = NULL, maxSD = NULL, verbose = FALSE,
silent = FALSE, UseCForVarip2 = TRUE, OPLENGTH = 1e+05)
Arguments
x |
The time series you want to test for second order
stationarity. This should be a stochastic series. The function
will report an error if |
alpha |
The overall (nominal) size of the test. |
filter.number |
The index number of the wavelet used to compute the evolutionary spectral estimate with. |
family |
The family of wavelet used to compute the evolutionary spectral estimate. |
lowlev |
Do not compute Haar wavelet coefficients on
evolutionary wavelet spectra at level lower than |
WTscale |
The theory of the test shows that the Haar wavelet
coefficients of the raw wavelet periodogram are asymptotically
normal as long as the scale of the Haar wavelet is
‘coarse’ enough. Roughly, speaking |
maxSD |
As part of its execution, this function computes an
evolutionary wavelet spectral estimate from the time series.
Since the test is based on the assumption of stationarity, the
EWS is averaged over time. There will be |
verbose |
If |
silent |
If |
UseCForVarip2 |
If |
OPLENGTH |
The |
Details
This function looks at the Haar wavelet coefficients of an evolutionary wavelet spectrum. This is a modification of the principle of von Sachs and Neumann (2000) which worked with the Haar wavelet coefficients of a local Fourier spectrum.
See also, the stationarity
test which implements
the Priestley-Subba Rao (1969) test. This function
is contained in the fractal
package.
Value
An object of class tos
, a list containing the following
components:
nreject |
The number of FDR rejections |
rejpval |
The p-value associated with FDR rejections |
spvals |
A vector of p-values from all of the tests, sorted in ascending order. |
sTS |
A vector of sorted test statistics from all of the tests,
sorted into the same order as |
AllTS |
A list containing all of the test statistics.
The first entry contains test statistics corresponding
to the coarsest scale, the last entry corresponds to the
finest scale. Each component in the list is either empty
(because the scale was omitted because it was less than
|
AllPVal |
As |
alpha |
The nominal size of the overall hypothesis test. |
x |
The original time series that was analyzed |
xSD |
A vector containing |
Author(s)
Guy Nason.
References
Nason, G.P. (2013) A test for second-order stationarity and approximate confidence intervals for localized autocovariances for locally stationary time series. J. R. Statist. Soc. B, 75, 879-904. doi:10.1111/rssb.12015
Priestley, M.B. and Subba Rao (1969) A test for non-stationarity of time series. J. R. Statist. Soc. B, 31, 140-149.
von Sachs, R. and Neumann, M.H. (2000) A wavelet-based test for stationarity. J. Time Ser. Anal., 21, 597-613.
See Also
varip2
, stationarity
Examples
#
# First, test a set of iid Gaussians: should be stationary!
#
hwtos2(rnorm(256))
# 8 7 6 5 4 3
#Class 'tos' : Stationarity Object :
# ~~~~ : List with 9 components with names
# nreject rejpval spvals sTS AllTS AllPVal alpha x xSD
#
#
#summary(.):
#----------
#There are 186 hypothesis tests altogether
#There were 0 FDR rejects
#No p-values were smaller than the FDR val of:
#Using Bonferroni rejection p-value is 0.0002688172
#And there would be 0 rejections.
#
# NOTE: the summary indicates that nothing was rejected: hence stationary!
#
# Second, example. Concatenated Gaussians with different variances
#
hwtos2(c(rnorm(256), rnorm(256,sd=2)))
# 9 8 7 6 5 4 3
#Class 'tos' : Stationarity Object :
# ~~~~ : List with 9 components with names
# nreject rejpval spvals sTS AllTS AllPVal alpha x xSD
#
#
#summary(.):
#----------
#There are 441 hypothesis tests altogether
#There were 5 FDR rejects
#The rejection p-value was 3.311237e-06
#Using Bonferroni rejection p-value is 0.0001133787
#And there would be 5 rejections.
#Listing FDR rejects... (thanks Y&Y!)
#P: 5 HWTlev: 0 indices on next line...[1] 1
#P: 6 HWTlev: 0 indices on next line...[1] 1
#P: 7 HWTlev: 0 indices on next line...[1] 1
#P: 8 HWTlev: 0 indices on next line...[1] 1
#P: 9 HWTlev: 0 indices on next line...[1] 1
#
# NOTE: This time 5 Haar wavelet coefficients got rejected: hence series
# is not stationary.