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.

1 2 3 |

`x` |
a vector containing a uniformly-sampled real-valued time series. |

`center` |
a logical value. If |

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

`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:

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

an object of class `stationarity`

.

- as.list
convert output to a list.

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.

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.

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

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.

All documentation is copyright its authors; we didn't write any of that.