Learn R Programming

locits (version 1.7.7)

Rvarlacf: Compute confidence intervals for localized autocovariance for locally stationary time series.

Description

Compute a localized autocovariance and associated confidence intervals for a locally stationary time series. The underlying theory assumes a locally stationary wavelet time series, but will work well for other time series that are not too far away.

Usage

Rvarlacf(x, nz, filter.number = 1, family = "DaubExPhase",
    smooth.dev = var, AutoReflect = TRUE, lag.max = NULL,
    WPsmooth.type = "RM", binwidth = 0, mkcoefOBJ, ThePsiJ,
    Cverbose = 0, verbose = 0, OPLENGTH = 10^5, var.lag.max = 3,
    ABB.tol = 0.1, ABB.plot.it = FALSE, ABB.verbose = 0,
    ABB.maxits = 10, truedenom=FALSE, ...)

Value

An object of class lacfCI. This is a list with the following components.

lag

The lags for which the localized autocovariance variance is computed

cvar

The variances associated with each localized autocovariance

the.lacf

The lacf class object that contains the localized autocovariances themselves. This object can be handled/plotted/etc using the functions in the costat package although plot.lacfCI contains much of the functionality of plot.lacf.

Arguments

x

The time series you wish to analyze

nz

The time point at which you wish to compute the localized autocovariance for.

filter.number

The analysis wavelet for many things, including smoothing. See wd for information on the various types.

family

The analysis wavelet family. See wd again.

smooth.dev

The deviance function used to perform smoothing of the evolutionary wavelet spectrum.

AutoReflect

The internal wavelet transforms assume periodic boundary conditions. However, most time series are not periodic (in terms of their support, e.g. the series at time 1 is not normally anywhere near the value of the series at time T). This argument, if TRUE mitigates this by reflecting the whole series by the right-hand end, computing the transform (for which periodic transforms are now valid) and then junking the second half of the estimate. Although this is slightly more computationally intensive, the results are better.

lag.max

The maximum number of lags to compute the localized autocovariance for. The default is the same as in the regular acf function.

WPsmooth.type

The type of smoothing of the evolutionary wavelet spectrum and the localized autocovariance. See the arguments to lacf.

binwidth

The smoothing bandwidth associated with the smoothing controlled by WPsmooth.type. If this value is zero then the binwidth is computed automatically by the routine. And if verbose>0 the value is also printed.

mkcoefOBJ

Optionally, the appropriate discrete wavelet transform object can be supplied. If it is not supplied then the routine automatically computes it. There is a small saving in providing it, so for everyday use probably not worth it.

ThePsiJ

As for mkcoefOBJ but the autocorrelation wavelet object.

Cverbose

If positive integer then the called C code produces verbose messages. Useful for debugging.

verbose

If positive integer >0 then useful messages are printed. Higher values give more information.

OPLENGTH

Parameter that controls storage allocated to the PsiJ routine. It is possible, for large time series, you might be asked to increase this value.

var.lag.max

Number of lags that you want to compute confidence intervals for. Usually, it is quick to compute for more lags, so this could usually be set to be the value of lag.max above.

ABB.tol

The routine selects the automatic bandwidth via a golden section search. This argument controls the optimization tolerance.

ABB.plot.it

Whether or not to plot the iterations of the automatic bandwidth golden section search. (TRUE/FALSE)

ABB.verbose

Positive integer controlling the amount of detail from the automatic bandwidth golden section search algorithm. If zero nothing is produced.

ABB.maxits

The maximum number of iterations in the automatic bandwidth golden section search.

truedenom

If TRUE use the actual number of terms in the sum as the denominator in the formula for the calculation of the covariance of the smoothed periodogram. If FALSE use the eqn(2s+1)^-2 (this was the default in versions prior to 1.7.4)

...

Other arguments

Author

Guy Nason.

Details

1. If binwidth=0 the function first computes the `best' linear running mean binwidth (bandwidth) for the smooth of the localized autocovariance. 2. The function computes the localized autocovariance smoothed with a running mean with the selected binwidth. Then, the variance of \(\hat{c}(z, \tau)\) is computed for the selected value of time z=nz and for the lags specified (in var.lag.max). The results are returned in an object of class lacfCI.

Note, this function computes and plots localized autocovariances for a particular and fixed time location. Various other plots, including perspective plots or the localized autocovariance function over all time can be found in the costat package. (Indeed, this function returns a lacfCI object that contains a lacf object, and interesting plots can be plotted using the plot.lacf function within costast.

References

Nason, G.P. (2013) A test for second-order stationarity and approximate confidence intervals for localized autocovariances for locally stationary time series. J. R. Statist. Soc. B, 75, 879-904. tools:::Rd_expr_doi("10.1111/rssb.12015")

See Also

plot.lacfCI, print.lacfCI, summary.lacfCI

Examples

Run this code
#
# Do localized autocovariance on a iid Gaussian sequence
#
tmp <- Rvarlacf(rnorm(256), nz=125)
#
# Plot the localized autocovariances over time (default plot, doesn't
# produce CIs)
#
if (FALSE) plot(tmp)
#
# You should get a plot where the lag 0 acs are all near 1 and all the
# others are near zero, the acfs over time. 
#
if (FALSE) plot(tmp, plotcor=FALSE, type="acf")
#
# This plots the autocovariances (note: \code{plotcor=FALSE}) and the
# type of plot is \code{"acf"} which means like a regular ACF plot, except
# this is c(125, tau), ie the acf localized to time=125 The confidence
# intervals are also plotted. 
# The plot subtitle indicates that it is c(125, tau) that is being plotted
#

Run the code above in your browser using DataLab