Computer lab 4: Advanced forecasting models - IDA

advertisement
LINKÖPING UNIVERSITY
Time series analysis, 732A34
Computer lab 4: Advanced forecasting models
Learning objectives
This computer lab aims to make the student familiar with
 modeling regression models with correlated errors
 modeling transfer function models
After completing this lab, the student shall:


understand how correlated error terms in linear regression models can influence
parameter estimates and forecasts;
be able to use the procedures AUTOREG and ARIMA in SAS and interpret the
output from that procedure;
Assignment 1: Regression with correlated error terms
Estimating a linear temporal trend
In computer lab 2 you downloaded a time series of annual Swedish population
records. Create an Excel file that contains one column with years and another column
with population records, and import this file to SAS 9.1. Use the log window to check
that the file was correctly imported.
Then use the SAS procedure AUTOREG to regress the population values on time. If
you want to fit a straight line and model the error terms as an AR(1) process, you can
submit the following commands:
proc autoreg;
model population=year /nlag=1;
run;
Other AR-processes can be defined analogously.
Examine how the model of the error terms influences the estimated intercept and
slope-parameters and the confidence intervals of these parameters. Compare in
particular how the results obtained by ordinary least squares regression (independent
error terms, proc reg in SAS) differ from the results obtained when the error terms are
modeled as an AR-process.
Assignment 2: Transfer function model
The file ‘gasfurnace.txt’ contains observations of the input gas rate to a gas furnace
and the percentage of carbon dioxide (CO2) in the output from the same furnace.
Import this file to SAS 9.1 and name the imported file gasfurnace. Inspect the log file
and check that the Excel file has been correctly imported.
LINKÖPING UNIVERSITY
Time series analysis, 732A34
Inspecting the series gasrate and CO2 with respect to stationarity and
tentative ARMA-models
Use SAS procedure ARIMA to calculate and plot the SAC and SPAC of each series
using different orders of differentiation:
proc arima data=gasfurnace;
identify var = Gasrate;
identify var = Gasrate(1);
.
.
identify var = CO2;
identify var = CO2(1);
.
.
run;
Computes SAC and SPAC for Gasrate
Computes SAC and SPAC for first-order
differences of Gasrate
Estimating and inspecting the tentative model
Data gasfurnace;
set gasfurnace
X1=lag(Gasrate);
X2=lag(X1);
X3=lag(X2);
X4=lag(X3);
X5=lag(X4);
X6=lag(X5);
X7=lag(X6);
X8=lag(X7);
X9=lag(X8);
X10=lag(X9);
run;
Find the r, s and b
proc autoreg;
model CO2=Gasrate X1-X10/nlag=1;
output out=ut rm=N;
run;
Find a model for the error N
proc arima data=ut;
identify var=N;
run;
Use prog autoreg again and fit a better model if you think it is needed.
proc arima data=gasfurnace;
identify var=CO2(?) crosscorr=Gasrate(?) noprint;
estimate p=? q=? input=(?$(?)/(?)Gasrate);
run;
LINKÖPING UNIVERSITY
Time series analysis, 732A34
Compare the performance of transfer function models and pure ARIMA
models
Use SAS (or Minitab) to fit an ordinary ARIMA model to the carbon dioxide
concentration. Compute the mean square prediction error and compare the result with
that obtained by the transfer function model.
To hand in
This course has individual written lab reporting. Write a concise report that shows that
you have done the assignments and reflected over the results obtained.
Deadline for reporting is normally one week after the lab has been made available on
the course website.
Download