Learn R Programming

costat (version 1.1-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 = "DaubExPhase", plot.it = FALSE, spec.filter.number = 1, spec.family = "DaubExPhase", plotcoef = FALSE, sameplot = TRUE, norm = FALSE, plotstystat = FALSE, plotsolinfo = TRUE, onlyacfs = FALSE, acfdatatrans = I, xlab = "Time", ...)

Arguments

res
Solution set returned by findstysols
tsx
The x time series
tsy
The y time series
inc
When plotting add an increment on where to start looking at the time series/solutions from
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 linea
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 optional
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 <
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.

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.

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

`Costationary and stationarity tests for stock index returns' by Cardinali and Nason

See Also

findstysols

Examples

Run this code
#
# The example follows on directly from the one in the help page in findstysols
#
LCTSres(tmp, tsx=x2, tsy=y2, solno=1)

Run the code above in your browser using DataLab