Tutorial for solution of Assignment week 39 “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, y t, for the period ”
Note! The time scale is best set to index here as the days are not consecutive in time series (Saturdays, Sundays and other holidays are not present)
“Construct also a point plot for all pairs (y t-1, y t ) and try to visually estimate how strong the correlation between two consecutive observations is (=autocorrelation).”
Strong positive autocorrelation! “How do the estimated autocorrelations change with increasing timelags between observations?” To estimate the autocorrelation function, copy the relevant rows (data for ) of column $US/SEK to a new column and use the autocorrelation function estimation on that column
As was deduced from the scatter plot, the autocorrelations are strongly positive. The autocorrelations do not change very much with increasing time lags. Note that this is what we see when the time series is non-stationary (has a trend).
“Construct a time series graph of the changes z t = y t - y t-1 of the dollar exchange rate. Then try to judge upon how the estimated autocorrelations for the series z t change with the time lag between observations and check your judgement by estimating the autocorrelations.” The changes are already present in the column Difference. The analogous procedures are applied to this column to produce the time series graph and the estimated acf plot, i.e. by including only values where column Year is 1994.
Noisy plot As previously plot z t vs. z t – 1 Seems to be no autocorrelation at all
Our conclusions are verified!
“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.” Additive model for deseasonalization seems best!
Plot DESE1(t) vs. DESE1(t-1) Indicates positive autocorrelation
Indication confirmed!
“C. Forecasting with autoregressive models Data set: The Dollar Exchange rates Consider again the time series of dollar exchange rates for the period 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.” Use the already created column of $US/SEK exchange rates from (there is no opportunity in Minitab’s ARIMA module to just analyze a subset of a column like in the graphing modules)
Forecasts for a 20 days period are requested. (Origin field is left blank analogously to previous modules) Three new columns should be entered here! See next slide!
Must be checked (not default) Should always by checked for diagnostic purposes
Final Estimates of Parameters Type Coef SE Coef T P AR Constant Mean Number of observations: 1229 Residuals: SS = (backforecasts excluded) MS = DF = 1227 Modified Box-Pierce (Ljung-Box) Chi-Square statistic Lag Chi-Square DF P-Value Significant! Keep in mind for comparison with next model OK!
Forecasts from period Percent Limits Period Forecast Lower Upper Actual These forecasts and prediction limits are stored in columns C12, C13 and C14 (as entered in dialog box)
Seems to be OK (as was confirmed by the Ljung-Box statistic)
The column widths_1 (C15) will later be compared with the widths from another model Use the stored prediction limits to calculate the widths of the prediction intervals
“Investigate also if the forecasts can improve by instead using an AR(2)-model.” Don’t forget to enter new columns here!
Final Estimates of Parameters Type Coef SE Coef T P AR AR Constant Mean Number of observations: 1229 Residuals: SS = (backforecasts excluded) MS = DF = 1226 Modified Box-Pierce (Ljung-Box) Chi-Square statistic Lag Chi-Square DF P-Value Non-significant! Slightly larger than in AR(1)-model Still OK!
Calculate widths for the new prediction intervals
Make a time series plot of the intervals widths from the two analyses.
Slightly wider prediction intervals with AR(2)-model (widths_2) Forecasts do not improve with AR(2)-model
“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?” AR(1): AR(2): No signs of serial correlations in resiaduals in any of the models
“D. ARIMA models and differentiation In this task you will first have to judge upon whether you need to differentiate the current time series ( z t = y t - y t-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 least 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?”
Note that the y- axis do not start at zero! A slight upward trend may be concluded “Are there any signs of long-time oscillations in the time series (that can be seen from the time series graph)?” Yes, there seem to be a cyclical variation with cycle periods longer than a year.
“Is there a fast cancel-out in the autocorrelations?” No, the cancel-out is not fast (although the spikes come quickly within the red limits) “Is there need for differentiation to get a time series suitable for ARMA- modelling?” Probably, but not certainly!
“D.2 Fitting different ARMA-models Calculate the estimated autocorrelations possibly after differentiation of the original series and display these estimates in a graph.” Without differentiation: (Slowly) decreasing postive autocorrelations. One positive spike (at lag 1) in SPAC Either this is a non-stationary time series or an AR(1)-time series with a close to 1.
With first-order differentiation (use the ready series of differences): No obvious pattern in any of these two plots. The differentiated series may be an ARMA-series
“Then try to predict the dollar exchange rate by combining differentiation with ARMA-models of different orders.” Strategy: On original series, try AR(1) On differentiated series, try AR(1), AR(2), MA(1), MA(2), ARMA(1,1), ARMA(1,2), ARMA(2,1) and ARMA(2,2) Compare the values of MS from each model. This measure corresponds with one- step-ahead prediction errors on the average.
ModelMS OriginalDifferentiated AR(1) AR(1) AR(2) MA(1) MA(2) ARMA(1,1) ARMA(2,1) ARMA(1,2) ARMA(2,2) None of the models on the differentiated series produces better MS value than the AR(1) on original series, but MS seems to decrease with larger complexity.
“What happens if one tries to fit a very complex model with a lot of parameters to the observations?” Study e.g. ARMA(3,3) and ARMA(4,4) on the differentiated series:
Final Estimates of Parameters Type Coef SE Coef T P AR AR AR MA MA MA Constant Differencing: 1 regular difference Number of observations: Original series 95, after differencing 94 Residuals: SS = (backforecasts excluded) MS = DF = 87 Modified Box-Pierce (Ljung-Box) Chi-Square statistic Lag Chi-Square DF P-Value No severe problems but not all parameters are significant! ARMA(3,3) Even lower than in ARMA(2,2)
No severe problems here either, but spikes seem to increase with lag!
Unable to reduce sum of squares any further Final Estimates of Parameters Type Coef SE Coef T P AR AR AR AR MA MA MA MA Constant Differencing: 1 regular difference Number of observations: Original series 95, after differencing 94 Residuals: SS = (backforecasts excluded) MS = DF = 85 Estimation problems! ARMA(4,4) Increased! None of the parameters are significant! Estimation problems and an increase in MS.
The conclusion must be that an AR(1)-model on original data seems to be the best. “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.” SAC and SPAC of residuals do not indicate that another ARIMA-model should be used.
There do not seem to be any violations of the assumption of normal distribution and constant variance either.