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.
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, ...)
An object of class lacfCI
. This is a list with
the following components.
The lags for which the localized autocovariance variance is computed
The variances associated with each localized autocovariance
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
.
The time series you wish to analyze
The time point at which you wish to compute the localized autocovariance for.
The analysis wavelet for many things, including
smoothing. See wd
for information on the various types.
The analysis wavelet family. See wd
again.
The deviance function used to perform smoothing of the evolutionary wavelet spectrum.
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.
The maximum number of lags to compute the localized
autocovariance for. The default is the same as in the
regular acf
function.
The type of smoothing of the evolutionary
wavelet spectrum and the localized autocovariance. See the
arguments to lacf
.
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.
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.
As for mkcoefOBJ
but the autocorrelation
wavelet object.
If positive integer then the called C code produces verbose messages. Useful for debugging.
If positive integer >0 then useful messages are printed. Higher values give more information.
Parameter that controls storage allocated to
the PsiJ
routine. It is possible, for large time series,
you might be asked to increase this value.
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.
The routine selects the automatic bandwidth via a golden section search. This argument controls the optimization tolerance.
Whether or not to plot the iterations of the
automatic bandwidth golden section search. (TRUE
/FALSE
)
Positive integer controlling the amount of detail from the automatic bandwidth golden section search algorithm. If zero nothing is produced.
The maximum number of iterations in the automatic bandwidth golden section search.
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
Guy Nason.
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
.
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")
plot.lacfCI
, print.lacfCI
,
summary.lacfCI
#
# 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