forecastlpacf {forecastLSW} | R Documentation |
Forecasts future values of the time series x
h
-steps ahead. (for the specified horizon h
) using the lpacf to decide the dimension of the generalized Yule-Walker equations.
Description
This function forecasts a x
time series h
-steps
ahead. The time series is assumed to be locally stationary
(actualy locally stationary wavelet) and uses a local prediction
method. The function makes use of the localized partial autocorrelation
function to decide the order of the local Yule-Walker equations
used in the forecast.
Usage
forecastlpacf(x,h=1,regularize=TRUE,lag.max=max(10,2*h),forecast.type=NULL,...)
Arguments
x |
Vector containing time series to generate forecasts for. |
h |
Integer. Maximum prediction horizon. Forecasts will be given for
one to |
regularize |
Logical. If |
lag.max |
Maximum lag that the |
forecast.type |
Options are |
... |
Other parameters to be passed to the periodogram and lacv (local autocovariance) estimation, e.g. |
Details
The function calculates the wavelet periodogram followed by the lacv and
lpacf
.
NOTE: Often when local (windowed) estimates are created one assigns the
estimated value to the central point in the window.
This is NOT the approach we take here when calculating the lacv and
lpacf
.
Instead we operate a rear facing window where the estimate is assigned to the
final point in the window.
The lpacf is used to decide the dimension of the local Yule-Walker equations used for forecasting.
The periodogram is then smoothed using a running mean smoother,
and then to get forecast lacv estimates.
The Yule-Walker equations give the forecast mean for h
steps ahead.
The standard deviation of the forecasts is also returned.
When we are trying to forecast h
steps ahead we use the lpacf to decide how many values (p
) we should use for prediction. The original method of Fryzlewicz et al. (2003) decides on p
and then does a h
step ahead forecast only using the p
last values. This is what forecast.type='fixed'
does, regardless of the size of p
in relation to h
. Note that the left hand side of the Yule-Walker matrix is fixed and only the right hand size (the forecast lacv) is changing. Thus the size of h
is not explicitly taken into account, there is just an inflated variance in the lacv estimate.
One other option is to use the intermediate forecast values as if they were observed and perform a recursive forecast - this is what forecast.type='recursive'
does. Here everything in the Yule-Walker equations is different for each forecast value.
A third option is to use forecast.type='fixed'
when p
is greater or equal to h
but then when we are trying to forecast beyond this we extend the Yule-Walker equations to be the same dimension as the forecast horizon. Thus using h
previous values instead of p
. This is what forecast.type='extend'
does.
The method closest to the stationary world is forecast.type='recursive'
.
The dforecastlpacf
internally differences the time series
and then performs the local forecasting as in forecastlpacf
but only for one-step ahead. The advantage is that subsequent plotting
routines can nicely show the original time series, with the forecasts
on the original (not differenced) scale with the forecast and appropriate
confidence interval.
Value
An object of class forecastlpacf
which is a list
with the following components.
mean |
Returns time series forecasts from one to |
std.err |
Returns the prediction error, which can be used for assessing the prediction intervals. Item |
lpacf |
Returns the estimated local partial autocovariance function |
ci |
The confidence interval on lpacf which was used used for the automatic calculation of p |
binwidth |
The automatic bandwidth used for the running mean smoother |
p |
Returns the automatic choice of p - the dimension of the generalized Yule-Walker equations. |
x |
The supplied original time series |
d |
Differencing that was applied to the input series before forecasting.
For |
Author(s)
R. Killick
References
Killick, R., Knight, M.I., Nason, G.P., Nunes M.A., Eckley I.A. (2023) Automatic Locally Stationary Time Series Forecasting with application to predicting U.K. Gross Value Added Time Series under sudden shocks caused by the COVID pandemic arXiv:2303.07772
Fryzlewicz, P., Van Bellegem, S. and von Sachs, R. (2003) Forecasting non-stationary time series by wavelet process modelling. Annals of the Institute of Statistical Mathematics, 55, 737-764.
Nason, G.P., von Sachs, R., Kroisandt, G. (2000) Wavelet processes and adaptive estimation of the evolutionary wavelet spectrum. J. Roy. Statist. Soc. B, 62, 271-292.
Xi, Y., Yu, J., Ranneby, B. (2007) Forecasting Using Locally Stationary Wavelet Processes.
See Also
lpacf
, forecastpanel
,
plot.forecastlpacf
,
print.forecastlpacf
,
summary.forecastlpacf
Examples
# first generate some non-stationary data we want to forecast
set.seed(1)
x=tvar2sim()
#predict 1-step ahead using Daubechies wavelets with 2 vanishing moments, although
#other choices for the wavelet family and filter are possible (including Haar)
pred<-forecastlpacf(x,h=1,filter.number=2,family="DaubExPhase",forecast.type='recursive')
#pred$mean gives the predicted value, while pred$std.err gives the prediction error