Computer exercise 4: Estimation of autocorrelations and

advertisement
LINKÖPINGS UNIVERSITET
Institutionen för datavetenskap
Statistik, CL, ANd
732G06 TIME SERIES ANALYSIS
Fall semester 2008
Assignment
Assignment week 39: Estimation of autocorrelations and forecasting by
autoregressive processes
This assignment consists of two tasks: The first task deals with estimating
autocorrelations and the other with making predictions by applying autoregressive (AR)
models.
Solutions should be submitted by Sunday 12 October!
Estimating autocorrelations
Data sets: The Dollar Exchange rates; Hjalmaren month
A. Time series without seasonal variation
Use the data in the file 'dollar.txt'. Construct a time series graph of the fluctuations of the
dollar exchange rate, yt, for the period 1994-1998. Construct also a point plot for all pairs
(yt-1 , yt) and try to visually estimate how strong the correlation between two consecutive
observations is (=autocorrelation). How do the estimated autocorrelations change with
increasing timelags between observations.
Construct a time series graph of the changes zt = yt - yt-1 of the dollar exchange rate. Then
try to judge upon how the estimated autocorrelations for the series zt change with the time
lag between observations and check your judgement by estimating the autocorrelations.
B. Time series with seasonal variation
Use the time series of monthly discharge in the lake Hjälmaren (‘Hjalmarenmonth.txt’),
which you have used in the assignment for week 36. Compute the autocorrelation
function (Minitab: StatTime seriesAutocorrelation…) for the variable Discharge.m.
Deseasonalise the time series and make a new graph of the seasonally adjusted values.
Try to visually estimate how the autocorrelations look like and check your judgement by
computing the autocorrelation function.
To deseasonalise the time series, you can use in Minitab 'StatTime
seriesDecomposition…', use Seasonal only and Storage Seasonally adjusted data.
C. Forecasting with autoregressive models
Data set: The Dollar Exchange rates
Consider again the time series of dollar exchange rates for the period 1994-1998. Then
use the Minitab time series module ARIMA (see further below) to estimate the
parameters in an AR(1)-model (1 nonseasonal autoregressive parameter) and plot the
observed values together with forecasts for a period of 20 days after the last observed
time-point. Investigate also if the forecasts can improve by instead using an AR(2)model.
Minitab’s module for ARIMA-modelling (Stat  Time Series  ARIMA…) is a general
model for times series with or without trend and seasonal effects. In the dialog box you
should choose different number of Autoregressive and Moving average components and
no Difference components. Also you should not mark the square for seasonal modelling.
Then an ARMA-model (AR-, MA- or ARMA-) will be estimated. In the dialog box you
can also as usual customize the output from the analysis. Click the different buttons
(Graphs, Forecast, Results, Storage) and make suitable choices. In the output in the
Session window the estimated model will appear and you can examine which model
components are significant etc.
With MINITAB’s ARIMA-module you can in one sequence perform the following three
operations:



calculate one-lag differences in the current time series
fit an AR(p)-model to the series of differences
calculate forecasts and predictions intervals for the original series
This is done by requesting 1 “difference” and p “autoregressive parameters” in the
MINITAB dialog box, keeping the box for seasonal modelling unchecked. Try different
values of p (start with p =1) in order to find a suitable forecasting model and draw a
graph for observed values and forecasts. Finally perform a residual analysis of the errors
in the one-step-ahead forecasts (can be asked for under the “Graph” button in the dialog
box. By residuals we mean here the errors in the one-step-ahead forecasts).
Are there any signs of serial correlations in the residuals?
D. ARIMA models and differentiation
In this task you will first have to judge upon whether you need to differentiate the current
time series ( zt = y t  yt-1 ) before forecasting with an ARMA-model can be applied. Then
you shall try different models with a number of parameters to find the model that gives
the last one-step-ahead prediction errors on the average. Finally you shall make some
residual plots to investigate if the selected model of forecasting can be improved.
Forecasting monthly dollar exchange rates in Danish crowns (DKK)
Data set: The Dollar-Danish Crowns Exchange rates
D.1. The need for differentiation
Construct a time series graph for the monthly means of dollar exchange rates in Danish
crowns (file ‘DKK.txt’). Then estimate the autocorrelations and display them in a graph.
Does the time series show any obvious upward or downward trend?
Are there any signs of long-time oscillations in the time series (that can be seen from the
time series graph)? Is there a fast cancel-out in the autocorrelations? Is there need for
differentiation to get a time series suitable for ARMA-modelling?
In Minitab use StatTime SeriesDifferences…
D.2 Fitting different ARMA-models
Calculate the estimated autocorrelations possibly after differentiation of the original
series and display these estimates in a graph. Then try to predict the dollar exchange rate
by combining differentiation with ARMA-models of different orders.
How many AR- and MA-terms respectively does it pay to bring into the model (in terms
of gain in predictability)? What happens if one tries to fit a very complex model with a
lot of parameters to the observations?
D.3. Residual analysis
Construct a graph for the residuals (the one-step-ahead prediction errors) and examine
visually if anything points to a possible improvement of the model.
Download