stationarity: Testing for stationarity in a time series

Description Usage Arguments Details Value S3 METHODS References See Also Examples

Description

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.

Usage

1
2
3
stationarity(x, n.taper=5,
    n.block=max(c(2, floor(logb(length(x), base=2)))), significance=0.05,
    center=TRUE, recenter=FALSE)

Arguments

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.

Details

The algorithms is outlined as follows:

1. Re-centering

The time series x is recentered by subtracting the sample mean.

2. Blocking

The recentered series is then segmented into n.block non-overlapping blocks in time.

3. Mutitaper SDF estimation

For each block, 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.

4. ANOVA table

A subset of each multitaper SDF estimate is formed by extracting only those values corresponding to frequencies which are approximately uncorrelated (the details of this exercise can be found in the references). Each subset (one per block) is stacked in rows such that an 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.

5. PSR statistics

Using the ANOVA table and (row, column, and grand) means of the ANOVA table, the Priesltey-Subba Rao statistics are generated: one for investigating time effects, one for investigating frequency effects, and one which combines the two to test time-frequency effects. See references for details.

6. Stationarity tests

The PSR statisitcs are then compared to corresponding chi-square ((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.

Value

an object of class stationarity.

S3 METHODS

as.list

convert output to a list.

print

prints the object. Available options are:

justify

text justification ala prettPrintList. Default: "left".

sep

header separator ala prettyPrintList. Default: ":".

n.digits

number of digits ala prettyPrintList. Default: 5.

...

Additional print arguments sent directly to the prettyPrintList function).

summary

prints a summary of the stationarity test results.

References

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.

See Also

hurstBlock.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
## 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)

Example output

Loading required package: splus2R
Loading required package: ifultools
1
2
3
4
5
6
N = 1024, nblock = 8, n_block_max = 94, dt =     1.0000
7
8
9
10
11
12
13
14
15
16
17
18
Priestley-Subba Rao stationarity Test for MIT-BIH Normal Sinus Rhythm RR Intervals: Record 16265
------------------------------------------------------------------------------------------------
Samples used              : 1024 
Samples available         : 1024 
Sampling interval         : 1 
SDF estimator             : Multitaper 
  Number of (sine) tapers : 5 
  Centered                : TRUE 
  Recentered              : FALSE 
Number of blocks          : 8 
Block size                : 128 
Number of blocks          : 8 
p-value for T             : 0.0001217759 
p-value for I+R           : 0.05929771 
p-value for T+I+R         : 0.001364758 
$test
                           T      I+R     T+I+R
Priestley-Subba Rao 29.41007 81.40406 110.81413
Chi-square quantile 14.06714 82.52873  90.53122

$anova
               f(3)      f(9)     f(15)     f(21)     f(27)     f(33)     f(39)
block 0   -4.349530 -5.913963 -8.295748 -8.107376 -7.277655 -7.284767 -7.793828
block 1   -4.615722 -6.235744 -6.591639 -7.190706 -8.358650 -7.422012 -8.084497
block 2   -4.594116 -5.509636 -7.278508 -8.712347 -8.074130 -8.296706 -8.594090
block 3   -5.615902 -6.431542 -8.348166 -9.063479 -9.401068 -8.088458 -8.419323
block 4   -5.101894 -5.271241 -6.401168 -7.996957 -7.649515 -8.878763 -8.731498
block 5   -4.729217 -5.884659 -7.501363 -7.976329 -8.121962 -9.282390 -9.522856
block 6   -4.958483 -5.350505 -6.571486 -8.844228 -8.955356 -7.838344 -9.142570
block 7   -5.818904 -5.728085 -6.579240 -7.555893 -7.605440 -7.555923 -8.705636
col means -4.972971 -5.790672 -7.195915 -8.180915 -8.180472 -8.080920 -8.624287
              f(45)     f(51)     f(57) row means
block 0   -8.855156 -8.536396 -7.772576 -7.418699
block 1   -8.775235 -9.031522 -8.296195 -7.460192
block 2   -8.889749 -9.033427 -8.663913 -7.764662
block 3   -9.896543 -9.323122 -9.161040 -8.374864
block 4   -8.067644 -8.786709 -8.977122 -7.586251
block 5   -9.274285 -8.272207 -8.296996 -7.886226
block 6   -8.568006 -9.208864 -8.553593 -7.799143
block 7   -8.423869 -8.756434 -9.356686 -7.608611
col means -8.843811 -8.868585 -8.634765 -7.737331

$freq
     f(3)      f(9)     f(15)     f(21)     f(27)     f(33)     f(39)     f(45) 
0.0234375 0.0703125 0.1171875 0.1640625 0.2109375 0.2578125 0.3046875 0.3515625 
    f(51)     f(57) 
0.3984375 0.4453125 

attr(,"class")
[1] "summary.stationarity" "list"                

fractal documentation built on May 1, 2019, 8:04 p.m.