stationarity {fractal} | R Documentation |
The Priestley-Subba Rao (PSR) test for nonstationarity is based upon examining how homogeneous a set of spectral density function (SDF) estimates are across time, across frequency, or both. The original test was formulated in the terms of localized lag window SDF estimators, but such estimators can suffer from bias due to leakage. To circumvent this potential problem, the SDF estimators are averages of multitaper SDF estimates using orthogonal sinusoidal tapers.
stationarity(x, n.taper=5, n.block=max(c(2, floor(logb(length(x), base=2)))), significance=0.05, center=TRUE, recenter=FALSE)
x |
a vector containing a uniformly-sampled real-valued time series. |
center |
a logical value. If TRUE , The mean value of the data is subtracted from the original series
prior to analyis. Default: TRUE . |
n.block |
the number of non-overlapping blocks with which the
time series will be uniformly divided. If the number of samples in the time series
is not evenly divisible by n.block , then those samples at the of the time series that do not fit into
the last block are ignored (rejected for analysis). Default: max(c(2, floor(logb(length(x), base=2)))) . |
n.taper |
an integer specifying the number of sinusoidal tapers to use in developing the eigenspectra for each block of the time series. Default: 5. |
recenter |
a logical value. If TRUE , the mean value of the data is subtracted
from the tapered series prior to forming a mutltiaper SDF estimate of the input time series. Default: TRUE . |
significance |
the significance is the number of times you expect the underlying hypothesis of stationarity to fail even though stationarity remains true. Essentially, you are allowing for error in the result. A significance of 0.05 means that you are allowing 5 percent error, i.e., you are 95 percent confident in the result. Default: 0.05. |
The algorithms is outlined as follows:
x
is recentered by subtracting the sample mean.n.block
non-overlapping blocks in time.n.taper
eigenspectra are formed by calculating the periodogram
of the block windowed by each of the n.taper
tapers. These eiegenspectra are then averaged to form a multitaper
SDF estimator for the current block.n.block
x M matrix (S)
is formed, where M is the number of (subset) Fourier frequencies. The (two-factor) ANOVA table (Y) is then formed via
Y=log(S) - psi(n.taper) + log(n.taper),
where psi() is the digamma function and log is the natural logarithm function.(1 - significance)
x 100) percentiles
(normalized by psi'(n.taper) where psi'() is the trigamma function).
Specifically, if the PSR statistic is found to be greater than the corresponding chi-square percentile, it indicates
that there is a 1 - significance
probability that the data is nonstationary.
an object of class stationarity
.
prettPrintList
. Default: "left"
.prettyPrintList
. Default: ":"
.prettyPrintList
. Default: 5.prettyPrintList
function).
Priestley, M. B. and Subba Rao, T. (1969) ``A Test for Stationarity of Time Series", Journal of the Royal Statistical Society, Series B, 31, pp. 140–9.
## assess the stationarity of the ecgrr series z <- stationarity(ecgrr, n.block=8) ## print the result, noting that all tests fail. ## The strongest failure attributed to the ## time-based fluctations of the eigenspectra print(z) ## print a summary of the results, including the ## ANOVA table of the eigenspectra summary(z)