Learn R Programming

costat (version 2.4.1)

LCTSres: Plots solutions that are identified by findstysols

Description

Plots lots of useful information concerning solutions identified using findstysols. It only plots those where the optimizer converged. Can additionally return the time-varying linear combination associated with any solution if plots are turned off.

Usage

LCTSres(res, tsx, tsy, inc = 0, solno = 1:nrow(res$endpar), filter.number = 1,
  family = c("DaubExPhase", "DaubLeAsymm"), plot.it = FALSE,
  spec.filter.number = 1,
  spec.family = c("DaubExPhase", "DaubLeAsymm"), plotcoef = FALSE,
  sameplot = TRUE, norm = FALSE, plotstystat = FALSE,
  plotsolinfo = TRUE, onlyacfs = FALSE,
  acfdatatrans = I, xlab = "Time", ...)

Value

The stationary solution, \(Z_t\), associated with the last solution to be plotted is returned. Of course, if there is only one solution to be plotted then it is the only possibility. Hence, if all the plot arguments are FALSE then no plots are produced and the stationary linear combination of the (last) solution number is returned.

Arguments

res

Solution set returned by findstysols

tsx

The x time series

tsy

The y time series

inc

Adds an increment to the x-axis values.

solno

Which solution number to look at. This can be a vector of solution numbers. The default is to look at all solutions (which can be a lot, depending on how many you've got)

filter.number

The wavelet filter number to use in reconstructing the linear combination function

family

The wavelet family to use in reconstructing the linear combination function.

plot.it

Currently unused in this function

spec.filter.number

This function computes the linear combination time series and also then computes its EWS. The wavelet (spec.filter.number is the filter number of this wavelet) used to compute the EWS can be different to the one used to compute the linear combination, as the latter is only a means to an end - e.g. in principle, other basis functions could be use in the linear combination. Also the spectrum computed is only used to assess its constancy, so could be a locally stationary Fourier one.

spec.family

The family of the wavelet used to compute the spectrum

plotcoef

If TRUE then only the linear combination functions are plotted. If FALSE then a (set of potentially multiple) composite plot(s) are produced. These composite plots are what are usually most useful.

sameplot

If TRUE then the linear combination functions are plotted on the same plot.

norm

If TRUE then the linear combination functions are normalized before plotting if sameplot is TRUE. This is so as to be able to compare the patterns in each function without regard to their overall size.

plotstystat

If TRUE (and if plotcoef=FALSE) this option causes the function to plot statistics associated with the stationary solution, \(Z_t\). The acf and partial acf are always plotted. The time series plot of \(Z_t\) and its spectrum are optionally plotted too if onlyacfs=FALSE.

plotsolinfo

If TRUE (and if plotsolinfo=FALSE) this option plots the \(\alpha_t\) linear combination function, the \(\beta_t\) one (ie both of them), the stationary linear combination \(Z_t\), and an estimate of the EWS of \(Z_t\) computed using the spec.filter.number and spec.family wavelet. The variance associated with \(Z_t\) (the minimizing variance from the optimizer in findstysols and the p-value associated with the solution are displayed as plot titles.

onlyacfs

Only plot the two acfs if plotstystat=TRUE

acfdatatrans

A function (e.g. log) to transform the series before taking and displaying the acf functions.

xlab

An x label for the time series plots, and spectral plots

...

Extra arguments for the acf plots.

Author

Guy Nason

Details

The function findstysols takes two time series and attempts to find time-varying linear combinations of the two that are stationary. If one is found, we call it \(Z_t\). However, findstysols works by numerical optimization, typically from random starts, and, generally, there is no unique stationary solution.

This function takes the results obtained by findstysols in an object called res and then for a set of solutions already identifed by the user, and supplied to this function via solno, this function takes each identified solution in turn and produces a set of plots.

Determining which solutions are interesting is another problem. The COEFbothscale is a useful function which can analyze all solution sets simultaneously and, usually, arrange them into groups which are mutually similar. Then representative members from each group can be further analyzed by LCTSres.

Probably the most useful set of options is plotcoef=FALSE and to issue a par(mfrow=c(2,2)) command prior to running LCTSres. This produces the plots, four to a page, and enables interesting features to be compared from plot to plot.

The plotcoef=FALSE option causes four plots to be produced (on the same page if mfrow is set as the previous paragraph suggests). The first two are the (potentially) time-varying linear combination functions, the next is the stationary linear combination, \(Z_t\), itself and the final plot is an estimate of the \(Z_t\)'s evolutionary wavelet spectrum. The titles of the latter two plots display the process variance of \(Z_t\) (the global unconditional variance, because \(Z_t\) is assumed to be stationary) and the p-value associated the the hypothesis test of stationarity of \(Z_t\). The spectral estimate show exhibit near constancy because of the stationarity (as assessed by hypothesis test) of \(Z_t\).

If plotstystat=TRUE then further plots are produced of the results of various classical time series analyses of \(Z_t\). If onlyacfs=TRUE then only the acf and partial acf of \(Z_t\) are plotted, otherwise \(Z_t\) and its classical spectrum are also plotted (remember, \(Z_t\), has tested to be stationary and so these classical methods are valid).

If more than one solution is to be plotted, then the scan() function is employed to pause the plots between plots.

References

Cardinali, A. and Nason, Guy P. (2013) Costationarity of Locally Stationary Time Series Using costat. Journal of Statistical Software, 55, Issue 1.

Cardinali, A. and Nason, G.P. (2010) Costationarity of locally stationary time series. J. Time Series Econometrics, 2, Issue 2, Article 1.

See Also

findstysols

Examples

Run this code
#
# See examples in findstysols (the plot method for the results of
# findstysols make use of LCTSres)

Run the code above in your browser using DataLab