1 ********************************************; 2 *** Blaisdel Co Example, NKNW table 12.2 ***; 3 ********************************************; 4 5 options ps=256 ls=111 nocenter nodate nonumber; 6 7 TITLE1 'Time Series - Blaisdel Co Example, NKNW table 12.2'; 8 data one; infile cards missover; 9 input CoSales IndSales; 10 time+1; 11 Cards; NOTE: The data set WORK.ONE has 20 observations and 3 variables. NOTE: DATA statement used: real time 0.04 seconds cpu time 0.04 seconds 32 ; 33 proc reg data=one; title2 'Step 1 : initial estimates'; 34 model CoSales = IndSales; 35 output out=two r=et p=yhat; 36 run; NOTE: 20 observations read. NOTE: 20 observations used in computations. NOTE: The data set WORK.TWO has 20 observations and 5 variables. NOTE: The PROCEDURE REG printed page 1. NOTE: PROCEDURE REG used: real time 0.18 seconds cpu time 0.13 seconds Time Series - Blaisdel Co Example, NKNW table 12.2 Step 1 : initial estimates The REG Procedure Model: MODEL1 Dependent Variable: CoSales Analysis of Variance Sum of Mean Source DF Squares Square F Value Pr > F Model 1 110.59832 110.59832 11648.6 <.0001 Error 18 0.17090 0.00949 Corrected Total 19 110.76922 Root MSE 0.09744 R-Square 0.9985 Dependent Mean 24.57300 Adj R-Sq 0.9984 Coeff Var 0.39653 Parameter Estimates Parameter Standard Variable DF Estimate Error t Value Pr > |t| Intercept 1 -1.43483 0.24196 -5.93 <.0001 IndSales 1 0.17616 0.00163 107.93 <.0001 37 data two; set two; etm1 = lag1(et); run; NOTE: There were 20 observations read from the data set WORK.TWO. NOTE: The data set WORK.TWO has 20 observations and 6 variables. NOTE: DATA statement used: real time 0.05 seconds cpu time 0.05 seconds 38 proc reg data=two; title2 'Step 2 : Fit to Lagged variables'; 39 model et = etm1; 40 run; NOTE: 20 observations read. NOTE: 1 observations have missing values. NOTE: 19 observations used in computations. NOTE: The PROCEDURE REG printed page 2. NOTE: PROCEDURE REG used: real time 0.07 seconds cpu time 0.07 seconds Time Series - Blaisdel Co Example, NKNW table 12.2 Step 2 : Fit to Lagged variables The REG Procedure Model: MODEL1 Dependent Variable: et Residual Analysis of Variance Sum of Mean Source DF Squares Square F Value Pr > F Model 1 0.07410 0.07410 13.15 0.0021 Error 17 0.09581 0.00564 Corrected Total 18 0.16991 Root MSE 0.07507 R-Square 0.4361 Dependent Mean 0.00162 Adj R-Sq 0.4029 Coeff Var 4642.55148 Parameter Estimates Parameter Standard Variable Label DF Estimate Error t Value Pr > |t| Intercept Intercept 1 -0.00140 0.01724 -0.08 0.9360 etm1 1 0.67369 0.18580 3.63 0.0021 41 data three; set one; 42 AdjCoSales = CoSales - 0.67369*lag1(CoSales); 43 AdjIndSales = IndSales - 0.67369*lag1(IndSales); NOTE: Missing values were generated as a result of performing an operation on missing values. Each place is given by: (Number of times) at (Line):(Column). 1 at 42:34 1 at 43:36 NOTE: There were 20 observations read from the data set WORK.ONE. NOTE: The data set WORK.THREE has 20 observations and 5 variables. NOTE: DATA statement used: real time 0.04 seconds cpu time 0.03 seconds 44 proc reg data=Three; title2 'Step 3 : Fit to Adjusted variables'; 45 model AdjCoSales = AdjIndSales; 46 run; NOTE: 20 observations read. NOTE: 1 observations have missing values. NOTE: 19 observations used in computations. NOTE: The PROCEDURE REG printed page 3. NOTE: PROCEDURE REG used: real time 0.08 seconds cpu time 0.08 seconds Time Series - Blaisdel Co Example, NKNW table 12.2 Step 3 : Fit to Adjusted variables The REG Procedure Model: MODEL1 Dependent Variable: AdjCoSales Analysis of Variance Sum of Mean Source DF Squares Square F Value Pr > F Model 1 12.80496 12.80496 2409.17 <.0001 Error 17 0.09036 0.00532 Corrected Total 18 12.89532 Root MSE 0.07290 R-Square 0.9930 Dependent Mean 8.35774 Adj R-Sq 0.9926 Coeff Var 0.87230 Parameter Estimates Parameter Standard Variable DF Estimate Error t Value Pr > |t| Intercept 1 -0.29108 0.17700 -1.64 0.1184 AdjIndSales 1 0.17260 0.00352 49.08 <.0001 b0 = -0.291/(1-0.674) = -0.89204 48 proc autoreg data=one; title2 'Time series with SAS AUTOREG (Lag of 1)'; 49 model CoSales = IndSales / nlag=1 method=ml; 50 output out=next1 p=yhat pm=pm r=r rm=rm ucl=ucl lcl=lcl 51 uclm=uclm lclm=lclm; 52 run; NOTE: The data set WORK.NEXT1 has 20 observations and 11 variables. NOTE: The PROCEDURE AUTOREG printed page 4. NOTE: PROCEDURE AUTOREG used: real time 0.07 seconds cpu time 0.07 seconds Time Series - Blaisdel Co Example, NKNW table 12.2 Time series with SAS AUTOREG (lag of 1) The AUTOREG Procedure Dependent Variable CoSales Ordinary Least Squares Estimates SSE 0.17090266 DFE 18 MSE 0.00949 Root MSE 0.09744 SBC -32.498862 AIC -34.490327 Regress R-Square 0.9985 Total R-Square 0.9985 Durbin-Watson 0.6633 Standard Approx Variable DF Estimate Error t Value Pr > |t| Intercept 1 -1.4348 0.2420 -5.93 <.0001 IndSales 1 0.1762 0.001632 107.93 <.0001 Estimates of Autocorrelations Lag Covariance Correlation -1 9 8 7 6 5 4 3 2 1 0 1 2 3 4 5 6 7 8 9 1 0 0.00855 1.000000 | |********************| 1 0.00551 0.644368 | |************* | Preliminary MSE 0.00500 Estimates of Autoregressive Parameters Standard Lag Coefficient Error t Value 1 -0.644368 0.185471 -3.47 Algorithm converged. Maximum Likelihood Estimates SSE 0.09401824 DFE 17 MSE 0.00553 Root MSE 0.07437 SBC -40.850047 AIC -43.837244 Regress R-Square 0.9958 Total R-Square 0.9992 Durbin-Watson 1.3656 Standard Approx Variable DF Estimate Error t Value Pr > |t| Intercept 1 -1.1935 0.4571 -2.61 0.0183 IndSales 1 0.1745 0.003081 56.63 <.0001 AR1 1 -0.6738 0.1938 -3.48 0.0029 Autoregressive parameters assumed given. Standard Approx Variable DF Estimate Error t Value Pr > |t| Intercept 1 -1.1935 0.4110 -2.90 0.0099 IndSales 1 0.1745 0.002760 63.22 <.0001 Time Series - Blaisdel Co Example, NKNW table 12.2 Time series with SAS AUTOREG (lag of 1) Output listing Co Ind Obs yhat r lcl ucl lclm uclm pm rm Sales Sales time 1 21.0159 -0.04132 20.7474 21.2845 20.8515 21.1803 21.0159 -0.05592 20.96 127.3 1 2 21.4493 -0.04930 21.2318 21.6668 21.3363 21.6377 21.4870 -0.08698 21.40 130.0 2 3 21.8994 0.06057 21.6906 22.1083 21.8202 22.0959 21.9580 0.00197 21.96 132.7 3 4 21.3836 0.13638 21.1640 21.6032 21.2286 21.5360 21.3823 0.13770 21.52 129.4 4 5 22.4521 -0.06209 22.2497 22.6544 22.2315 22.4871 22.3593 0.03070 22.39 135.0 5 6 22.7464 0.01364 22.5492 22.9436 22.6062 22.8452 22.7257 0.03432 22.76 137.1 6 7 23.4467 0.03334 23.2569 23.6364 23.3168 23.5303 23.4235 0.05646 23.48 141.1 7 8 23.7582 -0.09817 23.5705 23.9458 23.6172 23.8230 23.7201 -0.06013 23.66 142.8 8 9 24.1507 -0.05067 23.9651 24.3362 24.0922 24.2902 24.1912 -0.09118 24.10 145.5 9 10 24.0948 -0.08485 23.9092 24.2805 24.0571 24.2555 24.1563 -0.14629 24.01 145.3 10 11 24.5811 -0.04111 24.3960 24.7662 24.5815 24.7778 24.6797 -0.13969 24.54 148.3 11 12 24.2541 0.02592 24.0689 24.4393 24.2498 24.4466 24.3482 -0.06820 24.28 146.4 12 13 24.9652 0.03479 24.7794 25.1510 24.9117 25.1107 25.0112 -0.01117 25.00 150.2 13 14 25.5096 0.13041 25.3212 25.6980 25.4128 25.6215 25.5171 0.12288 25.64 153.1 14 15 26.3327 0.12733 26.1372 26.5281 26.1333 26.3664 26.2499 0.21013 26.46 157.3 15 16 26.9846 -0.00464 26.7810 27.1883 26.7132 26.9729 26.8431 0.13695 26.98 160.7 16 17 27.5460 -0.02596 27.3318 27.7601 27.3079 27.5994 27.4537 0.06632 27.52 164.2 17 18 27.7426 0.03738 27.5237 27.9615 27.5453 27.8506 27.6979 0.08207 27.78 165.6 18 19 28.2941 -0.05407 28.0638 28.5244 28.0702 28.4073 28.2388 0.00123 28.24 168.7 19 20 28.8153 -0.03533 28.5717 29.0590 28.6281 29.0009 28.8145 -0.03451 28.78 172.0 20 Time Series - Blaisdel Co Example, NKNW table 12.2 Time series with SAS AUTOREG (lag of 2) The AUTOREG Procedure Dependent Variable CoSales Ordinary Least Squares Estimates SSE 0.17090266 DFE 18 MSE 0.00949 Root MSE 0.09744 SBC -32.498862 AIC -34.490327 Regress R-Square 0.9985 Total R-Square 0.9985 Durbin-Watson 0.6633 Standard Approx Variable DF Estimate Error t Value Pr > |t| Intercept 1 -1.4348 0.2420 -5.93 <.0001 IndSales 1 0.1762 0.001632 107.93 <.0001 Estimates of Autocorrelations Lag Covariance Correlation -1 9 8 7 6 5 4 3 2 1 0 1 2 3 4 5 6 7 8 9 1 0 0.00855 1.000000 | |********************| 1 0.00551 0.644368 | |************* | 2 0.00166 0.194053 | |**** | Preliminary MSE 0.00428 Estimates of Autoregressive Parameters Standard Lag Coefficient Error t Value 1 -0.888057 0.231433 -3.84 2 0.378183 0.231433 1.63 Algorithm converged. Maximum Likelihood Estimates SSE 0.07851655 DFE 16 MSE 0.00491 Root MSE 0.07005 SBC -41.1288 AIC -45.111729 Regress R-Square 0.9971 Total R-Square 0.9993 Durbin-Watson 1.9565 Standard Approx Variable DF Estimate Error t Value Pr > |t| Intercept 1 -1.1979 0.3872 -3.09 0.0070 IndSales 1 0.1745 0.002615 66.75 <.0001 AR1 1 -0.9385 0.2335 -4.02 0.0010 AR2 1 0.3828 0.2337 1.64 0.1209 Autoregressive parameters assumed given. Standard Approx Variable DF Estimate Error t Value Pr > |t| Intercept 1 -1.1979 0.3520 -3.40 0.0036 IndSales 1 0.1745 0.002371 73.61 <.0001 Time Series - Blaisdel Co Example, NKNW table 12.2 REG: Plot of et by time Plot of et*time. Legend: A = 1 obs, B = 2 obs, etc. | 0.20 + | | A | | | A 0.15 + | | | | | A A 0.10 + | | | | R | A e 0.05 + s | A A A i | d | A u | A a | l 0.00 +---------------------------------------------------------------------------------------------------- | | | A | A | A -0.05 + | A | A | A | A | -0.10 + A | | | | | -0.15 + A A | ---+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+-- 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 time Time Series - Blaisdel Co Example, NKNW table 12.2 REG: Plot of et by sales Plot of et*IndSales. Legend: A = 1 obs, B = 2 obs, etc. | 0.20 + | | A | | | A 0.15 + | | | | | A A 0.10 + | | | | R | A e 0.05 + s | A A A i | d | A u | A a | l 0.00 +------------------------------------------------------------------------------------------------------ | | | A | A | A -0.05 + | A | A | A | A | -0.10 + A | | | | | -0.15 + A A | -+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+- 125 130 135 140 145 150 155 160 165 170 175 IndSales Time Series - Blaisdel Co Example, NKNW table 12.2 REG: Predicted & observed Plot of yhat*IndSales. Symbol used is 'x'. Plot of CoSales*IndSales. Symbol used is 'o'. | | 29 + | x | | | x 28 + | x P | o r | x e | d 27 + o i | x c | t | o e | x d 26 + | V | x a | l | u 25 + x e | | x o | x f | x o 24 + o C | x o | o S | x a | l 23 + e | x s | | x | 22 + x | | o | xx | 21 + x | ---+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+-- 125 130 135 140 145 150 155 160 165 170 175 IndSales NOTE: 14 obs hidden. Plot of yhat*IndSales. Symbol used is 'x'. Plot of CoSales*IndSales. Symbol used is 'o'. yhat | | 29 + | x | | | x 28 + | x | x | | 27 + x | | | x | 26 + | | x | | 25 + x | | x | | x x 24 + x | x | o | x | 23 + | x | | x | 22 + o | x | o | xx | 21 + x | ---+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+-- 125 130 135 140 145 150 155 160 165 170 175 IndSales NOTE: 17 obs hidden.