/* This is a combination forecasting exercise. */ /* The data used here is taken from J.A. Brandt and D.A. Bessler "Price Forecasting and Evaluation: An Application in Agriculture," Journal of Forecasting (July - Sept. 1983), pp. 237-248. */ /* The data consists of actual hog prices and forecasts from (1) an econometric model (ECON) and (2) an ARIMA model (ARIMA). */ /* The purpose here is to use these forecasts to build combination forecasts based on (1) the Nelson regression method (NELSON) and (2) the Granger-Ramanathan regression method (GR). */ /* Here is the in-sample data for building the combination forecasts. */ Data Hog; Input Period Actual Econ Arima; datalines; 7601 47.99 50.66 48.80 7602 49.19 46.37 49.06 7603 43.88 44.00 46.73 7604 34.25 39.96 39.77 7701 39.08 42.38 35.33 7702 40.87 41.65 39.42 7703 43.85 41.24 40.82 7704 41.38 49.81 45.08 7801 47.44 47.18 43.76 7802 47.84 48.67 45.83 7803 48.52 44.91 47.22 7804 50.05 52.39 47.21 7901 51.98 52.15 51.64 7902 43.04 52.63 50.39 7903 38.52 42.41 42.17 7904 36.39 41.30 37.96 ; /* Let's print out the data to be sure we entered it correctly. */ proc print data = hog; run; /* Now let's form the regression variables for calculating the various combination weights. */ data work; set hog; dep = actual - arima; explan = econ - arima; /* Now to calculate the Nelson combination weights. This method assumes that the two individual forecasts making up the combination forecasts are unbiased. */ Proc reg data = work; model dep = explan / noint; run; /* As one can see from this output the optimal combination weight to be applied to the econometric forecast is 0.15815 and, therefore, the optimal combination weight for the ARIMA model is 1 - 0.15815 = 0.84185. */ /* Now to calculate the Granger-Ramanathan combination weights. This method doesn't assume that both forecasts (ECON and ARIMA) are unbiased. One or more of the forecasts can be biased. */ Proc reg data = work; model actual = econ arima; run; /* As can be seen from this output, the Granger-Ramanathan forecast is of the form: (GR Combo) = 2.88917 + 0.25473*(ECON) + 0.66104*(ARIMA). */ /* Now let's see how good these combination forecasts methods are in an out-of-sample forecasting experiment as compared to the Econometric and ARIMA forecasts by themselves. */ Data Out; input period actual econ arima; datalines; 8001 36.74 43.51 35.17 8002 31.18 39.72 36.59 8003 46.23 37.23 34.34 8004 46.44 44.38 47.80 8101 41.13 44.85 47.12 8102 43.62 41.50 40.45 8103 50.42 44.21 45.95 8104 43.24 51.06 45.31 ; /* Now let's compute the out-of-sample forecasts for the Nelson combination, the Granger-Ramanathan combination, and a naive combination (the simple average of ECON and ARIMA forecasts.) */ data out; set out; Nelson = 0.15815* econ + 0.84185*arima; GR = 2.88917 + 0.25473*econ + 0.66104*arima; Ave = 0.5*econ + 0.5*arima; /* Let's print out the out-of-sample data set and the various forecasts. */ proc print data = out; run; /* Now let's compute the mean square errors and mean absolute errors of the various methods in the out-of-sample data. */ data compute; set out; eecon = actual - econ; earima = actual - arima; enelson = actual - nelson; egr = actual - gr; eave = actual - ave; aecon = abs(eecon); aarima = abs(earima); anelson = abs(enelson); agr = abs(egr); aave = abs(eave); secon = eecon**2; sarima = earima**2; snelson = enelson**2; sgr = egr**2; save = eave**2; /* Here we compute the mean absolute errors of the competing methods. */ proc univariate data = compute noprint; var aecon aarima anelson agr aave; output mean = maeecon maearima maenelson maegr maeave out=results1; run; /* Here we compute the mean square errors of the competing methods. */ proc univariate data = compute noprint; var secon sarima snelson sgr save; output mean = mseecon msearima msenelson msegr mseave out=results2; run; /* Now print out the results of the out-of-sample forecasting experiment. */ proc print data = results1; var maeecon maearima maenelson maegr maeave; title1 ' '; title2 'The Mean Absolute Errors of the Competing Methods'; run; proc print data = results2; var mseecon msearima msenelson msegr mseave; title1 ' '; title2 'The Mean Square Errors of the Competing Methods'; run;