lpacf.Epan {lpacf} | R Documentation |
Calculates the lpacf (local partial autocorrelation function) using an Epanechnikov kernel spectral smoother.
Description
This calculates the local partial autocorrelation function for data x
based on spectral smoothing using the Epanechnikov kernel. Up to lag.max
lags are calculated.
Usage
lpacf.Epan(x, binwidth, lag.max=NULL, filter.number=10, family="DaubLeAsymm",
smooth.dev=var, AutoReflect=TRUE, tol=0.1, maxits=5, ABBverbose=0, lapplyfn=lapply,
allpoints=FALSE, verbose=FALSE, ...)
Arguments
x |
The time series you wish to analyze |
binwidth |
The bandwidth for the spectral smoothing. If the argument is missing or zero then the bandwidth
is chosen automatically using the |
lag.max |
The maximum lag of pacf required. If this argument is
|
filter.number |
The wavelet filter number for helping choose
the smoothing |
family |
The wavelet family for helping choose the smoothing
|
smooth.dev |
The type of deviance used by |
AutoReflect |
Mitigate periodic boundary conditions of wavelet transforms
by reflecting time series about RHS end before taking
transforms (and is undone before returning the answer).
Setting this to be |
tol |
Tolerance for golden section search for the best bandwidth used
only by |
maxits |
Maximum number of iterations for the golden section search used by
|
ABBverbose |
If nonzero prints out informative messages about the progress of the golden section search. Higher integers produce more messages. Setting it to zero suppresses messages. |
lapplyfn |
Function which applies a specified function to a vector. lapply is default but this argument can be used to replace this by something more efficient, e.g. a parallel version such as |
allpoints |
The lpacf is calculated using a window centered on a time point, if allpoints=TRUE then the edges of the data are also estimated (where a smaller, non-centered binwidth is used). Note, if |
verbose |
If |
... |
Other arguments for |
Details
Calculates the local partial autocorrelation function (lpacf) for 1,...,lag.max
lags. See paper in the references for more details.
NOTE: Often when local (windowed) estimates are created one assigns the estimated value to the central point in the window. This is the approach we take here when calculating the lacv and lpacf. This differs from the lpacf calculated for the forecastlpacf
function which assign the estimated value to the last point in the window.
The function works by using the regular R pacf
applied to carefully
chosen windows of the original series. Note: code in the
forecastlpacf
from the forecastLSW
package can compute a slightly different version of the
localized pacf using a wavelet method.
Value
An object of class lpacf
. This is a list with the following
components:
the.x |
the time coordinates of the localized partial autocorrelations. Call the length of this vector n. These coordinates can be non-integer (usually at halves) even if the original times are at the integers (which is assumed by this function). You can think of these indexing the value of the localized partial autocorrelation centred at these locations. |
lpacf |
The localized partical autocorrelations.
Matrix of dimension n x |
the.vacc |
This is |
the.x1 |
If |
the.x2 |
As for |
vacc |
A vector of length two containing the interval of time points for which the localized autocovariance is computed using the largest number of points in the calculation — ie the full binwidth. |
binwidth |
The smoothing binwidth that was used. |
AutoBinWidth |
This is |
Author(s)
Guy Nason and Rebecca Killick
References
Killick, R., Knight, M. I., Nason, G.P. and Eckley, I. A. (2020) The local partial autocorrelation function and some applications. Electron. J. Statist. 14 (2), 3268-3314. DOI: 10.1214/20-EJS1748.
See Also
lpacf
, lpacf.plot
, forecastlpacf
,
plot.lacf
, print.lpacf
, summary.lpacf
Examples
# first generate a time-varying process
set.seed(1)
x=tvar2sim()
x.lpacf <- lpacf(x)
#
# There are two functions to plot lpacf class objects
#
# One is via the generic function plot which uses plot.lpacf
# the other is a bespoke function lpact.plot. We'll look at
# the generic function first which behaves similarly to the equivalent
# function in the locits package: plot.lacf
#
#
# This plot shows all of the localized partial autocovariances up to lag 27
# which is the default calculated value for this length of time series.
plot(x.lpacf)
#
# In the previous plot, maybe there were too many lags. So, let's restrict to
# five lags and colour them differently.
#
plot(x.lpacf, lags=1:5, lcol=1:5)
#
# By default, the lpacf is not computed for the whole time series range.
# Let's do it for all the points now, and replot.
#
x.lpacf.all <- lpacf(x, allpoints=TRUE)
plot(x.lpacf.all, lags=1:5, lcol=1:5)
#
#
# Suppose we wanted to look at the localized partial autocorrelation at a
# particular time point, using the regular acf-like plot. We can do this by:
#
# We will choose the time point to examine the localized pacf at as 150.
#
plot(x.lpacf, type="acf", the.time=150)
# calculate the lpacf
ans<-lpacf.Epan(x,lag.max=10,filter.number=2,family="DaubExPhase")
# then maybe plot it by lag
lpacf.plot(ans,atLag=1:10,atTime=100)