prodcomb {costat} R Documentation

Combine two time series using a time-varying linear combination.

Description

This function takes the cfs vector and splits it into two halves. The first half contains the wavelet coefficients for the alpha linear combination function, and the second half for the beta one. Then the functions themselves are generated by using the coeftofn function. Then, the coefficient functions are multiplied by the respective time series (tsx by alpha and tsy by beta) and the result returned.

Usage

prodcomb(cfs, tsx, tsy, filter.number = 1,
family = c("DaubExPhase", "DaubLeAsymm"), all = FALSE)


Arguments

 cfs Wavelet coefficients of the two combination functions. The coefficients for alpha/beta combination functions are stored in the first/last half of the vector. tsx The x time series to combine tsy The y time series to combine filter.number The wavelet filter to use to obtain functions from coefficients family The wavelet family to do the same. all If TRUE then a list containing the combined series in the component lcts and the combination functions in components alpha and beta. Although the combined series is the thing that is usually later tested for stationarity, it is often useful to see, at some stage, what the combination functions are, as these provide interpretation as to what the combination might mean. If FALSE then just the combined series is returned.

Details

This function is called by findstysols and makes use of coeftofn to turn coefficients into a function used in the combination.

Value

If all=TRUE then a list with the following components:

 lcts The combined series, \alpha_t X_t + \beta_t Y_t alpha The \alpha_t combination function. beta The \beta_t combination function.

If all=FALSE then only lcts is returned.

Guy Nason

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.

findstysols, coeftofn

Examples

#
# Toy example
#
tmp.a <- c(1, -1)
tmp.b <- c(0.5, 0.5)
#
# Generate toy time series
#
xxx <- rnorm(256)
yyy <- rnorm(256)
#
# Combine xxx and yyy using the functions produced by inverse wavelet
# transform of tmp.a and tmp.b
#
## Not run: tmp <- prodcomb(c(tmp.a, tmp.b), tsx=xxx, tsy=yyy)
#
# E.g. plot combination
#
## Not run: ts.plot(tmp)
#
# Potentially test its stationarity.... etc
#


[Package costat version 2.4 Index]