1 econ 240c lecture 10. 2 2outline box-jenkins passengers box-jenkins passengers displaying the...
Post on 19-Dec-2015
216 views
TRANSCRIPT
1
ECON 240CECON 240C
Lecture 10Lecture 10
2
2OutlineOutline Box-Jenkins PassengersBox-Jenkins Passengers
Displaying the ForecastDisplaying the Forecast RecoloringRecoloring
ARTWO’s and cyclesARTWO’s and cycles Time seriesTime series Autocorrelation functionAutocorrelation function
Private housing Starts- Single UnitsPrivate housing Starts- Single Units Review: Unit RootsReview: Unit Roots Midterm 2002Midterm 2002
3
3Forecasting Seasonal Forecasting Seasonal
Difference in the Difference in the Fractional ChangeFractional Change
Estimation period: 1949.01 – Estimation period: 1949.01 – 1960.121960.12
Forecast period: 1961.01 – 1961.12Forecast period: 1961.01 – 1961.12
4
4Eviews forecast command window
5
5Eviews plot of forecast plus or minus two standard errors Of the forecast
6
6Eviews spreadsheet view of the forecast and the standard Error of the forecast
7
7Using the Quick Menu and the show command to create Your own plot or display of the forecast
-0.15
-0.10
-0.05
0.00
0.05
0.10
0.15
55 56 57 58 59 60 61
SDDLNBJPSDDLNBJPF
SDDLNBJPF+2*SEFSDDLNBJPF-2*SEF
!2 Month Forecadt of Fractional Change
9
9Note: EViews sets the forecast variable equal to the observedValue for 1949.01-1960.12.
10
10To Differentiate the To Differentiate the Forecast from the Forecast from the
observed variable ….observed variable …. In the spread sheet window, click In the spread sheet window, click
on edit, and copy the forecast on edit, and copy the forecast values for 1961.01-1961.12 to a values for 1961.01-1961.12 to a new column and paste. Label this new column and paste. Label this column forecast.column forecast.
11
11Note: EViews sets the forecast variable equal to the observedValue for 1949.01-1960.12.
12
12Displaying the ForecastDisplaying the Forecast
Now you are ready to use the Quick Now you are ready to use the Quick menu and the show command to menu and the show command to make a more pleasing display of the make a more pleasing display of the data, the forecast, and its data, the forecast, and its approximate 95% confidence approximate 95% confidence interval.interval.
13
13Qick menu, show command window
-0.15
-0.10
-0.05
0.00
0.05
0.10
0.15
55 56 57 58 59 60 61
SDDLNBJPFORECAST
FORECAST+2*SEFFORECAST-2*SEF
Twelve Month Forecast ofSeasonal Difference in Fractional Change
15
15RecoloringRecoloring
The seasonal difference of the fractional The seasonal difference of the fractional change in airline passengers may be change in airline passengers may be appropriately pre-whitened for Box-Jenkins appropriately pre-whitened for Box-Jenkins modeling, but it is hardly a cognitive or modeling, but it is hardly a cognitive or intuitive mode for understanding the data. intuitive mode for understanding the data. Fortunately, the transformation process is Fortunately, the transformation process is reversible and we recolor, i.e put back the reversible and we recolor, i.e put back the structure we removed with the structure we removed with the transformations by using the definitions of transformations by using the definitions of the transformations themselvesthe transformations themselves
16
16
RecoloringRecoloring Summation or integration is the opposite of Summation or integration is the opposite of
differencing.differencing. The definition of the first difference is: The definition of the first difference is:
(1-Z) x(t) = x(t) –x(t-1)(1-Z) x(t) = x(t) –x(t-1) But if we know x(t-1) at time t-1, and we But if we know x(t-1) at time t-1, and we
have a forecast for (1-Z) x(t), then we can have a forecast for (1-Z) x(t), then we can rearrange the differencing equation and do rearrange the differencing equation and do summation to calculate x(t): x(t) = xsummation to calculate x(t): x(t) = x00(t-1) + (t-1) + EEt-1 t-1 (1-Z) x(t)(1-Z) x(t)
This process can be executed on Eviews by This process can be executed on Eviews by using the Generate commandusing the Generate command
17
17
RecoloringRecoloring In the case of airline passengers, it is In the case of airline passengers, it is
easier to undo the first difference first easier to undo the first difference first and then undo the seasonal difference. and then undo the seasonal difference. For this purpose, it is easier to take the For this purpose, it is easier to take the transformations in the order, natural transformations in the order, natural log, seasonal difference, first differencelog, seasonal difference, first difference
Note: (1-Z)(1-ZNote: (1-Z)(1-Z1212)lnBJPASS(t) = (1-Z)lnBJPASS(t) = (1-Z1212))(1-Z) lnBJPASS(t), i.e the ordering of (1-Z) lnBJPASS(t), i.e the ordering of differencing does not matter differencing does not matter
-0.1
0.0
0.1
0.2
0.3
0.4
49 50 51 52 53 54 55 56 57 58 59 60
SDLNBJPASS
Seasonal difference in thenatural log of airline passengers
19
19Correlogram of Seasonal Difference in log of passengers.Note there is still structure, decay in the ACF, requiring A first difference to further prewhiten
-0.15
-0.10
-0.05
0.00
0.05
0.10
0.15
49 50 51 52 53 54 55 56 57 58 59 60
DSDLNBJP
First Difference in the Seasonal Difference of theNatural Logarithm of Airline Passengers
As advertised, either order of differencing results in theSame pre-whitened variable
21
21Using Eviews to RecolorUsing Eviews to Recolor DSDlnBJP(t) = SDlnBJPASS(t) – SDBJPASS(t-1)DSDlnBJP(t) = SDlnBJPASS(t) – SDBJPASS(t-1) DSDlnBJP(1961.01) = SDlnBJPASS(1961.01) – DSDlnBJP(1961.01) = SDlnBJPASS(1961.01) –
SDlnBJPASS(1960.12)SDlnBJPASS(1960.12) So we can rearrange to calculate forecast So we can rearrange to calculate forecast
values of SDlnBJPASS from the forecasts for values of SDlnBJPASS from the forecasts for DSDlnBJPDSDlnBJP
SDlnBJPASSF(1961.01) = DSDlnBJPF(1961.01) SDlnBJPASSF(1961.01) = DSDlnBJPF(1961.01) + SDlnBJPASS(1960.12)+ SDlnBJPASS(1960.12)
We can use this formula in iterative fashion as We can use this formula in iterative fashion as SDlnBJPASSF(1961.01) = DSDlnBJPF(1961.01) SDlnBJPASSF(1961.01) = DSDlnBJPF(1961.01) + SDlnBJPASSF(1960.12), but we need an + SDlnBJPASSF(1960.12), but we need an initial value for SDlnBJPASSF(1960.12) since initial value for SDlnBJPASSF(1960.12) since this is the last time period before forecasting. this is the last time period before forecasting.
22
22The initial valueThe initial value
This problem is easily solved by This problem is easily solved by generating SDlnBJPASSF(1960.12) = generating SDlnBJPASSF(1960.12) = SDlnBJPASS(1960.12) SDlnBJPASS(1960.12)
23
23Recoloring: Generating the Recoloring: Generating the forecast of the seasonal forecast of the seasonal difference in lnBJPASSdifference in lnBJPASS
-0.1
0.0
0.1
0.2
0.3
0.4
49 50 51 52 53 54 55 56 57 58 59 60 61
SDLNBJPASS SDLNBJPASSF
Forecast of the Seasonal difference in theNatural Logarithm of Airline Passengers
25
25
-0.05
0.00
0.05
0.10
0.15
0.20
0.25
49 50 51 52 53 54 55 56 57 58 59 60 61
SDLNBJPAFSDLNBJPAF+2*SEFSDLNBJPAF-2*SEF
Forecast of sdlnbjpaForecast of sdlnbjpa
26
26Recoloring to Undo the Recoloring to Undo the
Seasonal Difference in the Seasonal Difference in the Log of PassengersLog of Passengers
Use the definition: SDlnBJPASS(t) = Use the definition: SDlnBJPASS(t) = lnBJPASS(t) – lnBJPASS(t-12),lnBJPASS(t) – lnBJPASS(t-12),
Rearranging and putting in terms of the Rearranging and putting in terms of the forecasts lnBJPASSF(1961.01) = forecasts lnBJPASSF(1961.01) = lnBJPASS(1960.12) + lnBJPASS(1960.12) + SDlnBJPASSF(1961.01)SDlnBJPASSF(1961.01)
In this case we do not need to worry In this case we do not need to worry about initial values in the iteration about initial values in the iteration because we are going back twelve because we are going back twelve months and adding the forecast for the months and adding the forecast for the seasonal differenceseasonal difference
27
27
4.5
5.0
5.5
6.0
6.5
7.0
49 50 51 52 53 54 55 56 57 58 59 60 61
LNBJPASS LNBJPASSF
Forecast in the Natural Logarithm of Airline Passengers
29
29lnbjpassflnbjpassf
5.8
6.0
6.2
6.4
6.6
49 50 51 52 53 54 55 56 57 58 59 60 61
LNBJPASSFLNBJPASSF+2*SEFLNBJPASSF-2*SEF
30
30The Harder Part is OverThe Harder Part is Over
Once the difference and the seasonal Once the difference and the seasonal difference have been undone by difference have been undone by summation, the rest requires less summation, the rest requires less attention to detail, plus double attention to detail, plus double checking, to make sure your checking, to make sure your commands to Eviews were correct.commands to Eviews were correct.
31
31
32
32The Last StepThe Last Step
To convert the forecast of lnBJPASS To convert the forecast of lnBJPASS to the forecast of BJPASS use the to the forecast of BJPASS use the inverse of the logarithmic inverse of the logarithmic transformation, namely the transformation, namely the exponentialexponential
33
33
0
100
200
300
400
500
600
700
49 50 51 52 53 54 55 56 57 58 59 60 61
BJPASS BJPASSF
Twelve Month forward Forecast of Airline Passengers
35
35Confidence IntervalsConfidence Intervals
The confidence interval can be The confidence interval can be generated as:generated as: Lnupper = lnbjpass + 2*sefLnupper = lnbjpass + 2*sef Lnlower = lnbjpassf-2*sefLnlower = lnbjpassf-2*sef And then exponentiated:And then exponentiated: Upper= exp(lnupper)Upper= exp(lnupper) Lower=exp(lnlower)Lower=exp(lnlower)
36
36
37
37Part I: ARTWO’s and Part I: ARTWO’s and CyclesCycles
ARTWO(t) = bARTWO(t) = b1 1 ARTWO(t-1) + bARTWO(t-1) + b2 2 ARTWO(t-2) ARTWO(t-2) + + WN(t)WN(t)
ARTWO(t) = bARTWO(t) = b1 1 ARTWO(t-1) + bARTWO(t-1) + b2 2 ARTWO(t-2) ARTWO(t-2) is the homogenous deterministic part of is the homogenous deterministic part of the equation after dropping the stochastic the equation after dropping the stochastic part, WN(t).part, WN(t).
Substitute ySubstitute y2-u 2-u for ARTWO(t-u) to obtain: for ARTWO(t-u) to obtain: yy2 2 =b=b1 1 yy11 + b + b2 2 yy00
Or yOr y2 2 - b- b1 1 yy11 - b - b2 2 = 0, which is a quadratic= 0, which is a quadratic
38
38
Note that the corresponding equation Note that the corresponding equation for the autocorrelation function has the for the autocorrelation function has the same behavior:same behavior:
(2) = b(2) = b1 1 (1) + b(1) + b2 2 (0)(0) Let yLet y2-u 2-u 2-u), then2-u), then yy2 2 =b=b1 1 yy11 + b + b2 2 yy00 The same homogeneous equation for The same homogeneous equation for
the autocorrelation function as for the the autocorrelation function as for the process, so if the process cycles so will process, so if the process cycles so will the autocorrelation functionthe autocorrelation function
39
39Simulated ARTWOSimulated ARTWO
ARTWO = 0.6*ARTWO(-1) - 0.8*ARTWO(-ARTWO = 0.6*ARTWO(-1) - 0.8*ARTWO(-2)+ WN2)+ WN
40
40
-4
-2
0
2
4
10 20 30 40 50 60 70 80 90 100
ARTWO
Artwo = 0.6*artwo(-1) - 0.8*artwo(-2) + wn
41
41
42
42Estimated Coefficients: Simulated ARTWO
43
43Privately Owned Housing Privately Owned Housing StartsStarts
44
44
45
45
46
46
47
47
48
48
49
49
50
50
51
51
52
52
53
53Part II: Unit RootsPart II: Unit Roots
First Order Autoregressive or First Order Autoregressive or RandomWalk?RandomWalk? y(t) = b*y(t-1) + wn(t)y(t) = b*y(t-1) + wn(t) y(t) = y(t-1) + wn(t)y(t) = y(t-1) + wn(t)
54
54Unit RootsUnit Roots
y(t) = b*y(t-1) + wn(t)y(t) = b*y(t-1) + wn(t) we could test the null: b=1 against b<1we could test the null: b=1 against b<1 instead, subtract y(t-1) from both sides:instead, subtract y(t-1) from both sides: y(t) - y(t-1) = b*y(t-1) - y(t-1) + wn(t)y(t) - y(t-1) = b*y(t-1) - y(t-1) + wn(t) or or y(t) = (b -1)*y(t-1) + wn(t) y(t) = (b -1)*y(t-1) + wn(t) so we could regress so we could regress y(t) on y(t-1) and y(t) on y(t-1) and
test the coefficient for y(t-1), i.e.test the coefficient for y(t-1), i.e. y(t) = g*y(t-1) + wn(t), where g = (b-y(t) = g*y(t-1) + wn(t), where g = (b-
1)1) test null: (b-1) = 0 against (b-1)< 0test null: (b-1) = 0 against (b-1)< 0
55
55Unit RootsUnit Roots
i.e. test b=1 against b<1i.e. test b=1 against b<1 This would be a simple t-test except This would be a simple t-test except
for a problem. As b gets closer to one, for a problem. As b gets closer to one, the distribution of (b-1) is no longer the distribution of (b-1) is no longer distributed as Student’s t distributiondistributed as Student’s t distribution
Dickey and Fuller simulated many Dickey and Fuller simulated many time series with b=0.99, for example, time series with b=0.99, for example, and looked at the distribution of the and looked at the distribution of the estimated coefficient estimated coefficient
g
56
56Unit RootsUnit Roots
Dickey and Fuller tabulated these Dickey and Fuller tabulated these simulated results into Tablessimulated results into Tables
In specifying Dickey-Fuller tests In specifying Dickey-Fuller tests there are three formats: no constant-there are three formats: no constant-no trend, constant-no trend, and no trend, constant-no trend, and constant-trend, and three sets of constant-trend, and three sets of tables.tables.
57
57Unit RootsUnit Roots
Example: the price of gold, weekly Example: the price of gold, weekly data, January 1992 through data, January 1992 through December 1999December 1999
58
58
250
300
350
400
450
1/06/92 12/06/93 11/06/95 10/06/97 9/06/99
Trace of the Weekly Closing Price of Gold
59
59
0
10
20
30
40
50
60
260 280 300 320 340 360 380 400
Series: GOLDSample 1/06/1992 12/27/1999Observations 417
Mean 345.7320Median 352.5000Maximum 414.5000Minimum 253.8000Std. Dev. 41.31026Skewness -0.514916Kurtosis 1.999475
Jarque-Bera 35.82037Probability 0.000000
60
60
61
61
62
62
63
63
64
64
0.0
0.1
0.2
0.3
0.4
0.5
-4 -2 0 2 4
TVAR
TDE
NS
Simulated Student's t-Distribution, 415 Degrees of Freedom
5%
- 1.65
65
65Dickey-Fuller TestsDickey-Fuller Tests
The price of gold might vary around a The price of gold might vary around a “constant”, for example the marginal cost “constant”, for example the marginal cost of productionof production
PPGG(t) = MC(t) = MCG G + RW(t) = MC+ RW(t) = MCG G + WN(t)/[1-Z]+ WN(t)/[1-Z]
PPGG(t) - MC(t) - MCG G = RW(t) = WN(t)/[1-Z]= RW(t) = WN(t)/[1-Z]
[1-Z][P[1-Z][PGG(t) - MC(t) - MCG G ] = WN(t)] = WN(t)
[P[PGG(t) - MC(t) - MCG G ] - [P] - [PGG(t-1) - MC(t-1) - MCG G ] = WN(t)] = WN(t)
[P[PGG(t) - MC(t) - MCG G ] = [P] = [PGG(t-1) - MC(t-1) - MCG G ] + WN(t)] + WN(t)
66
66Dickey-Fuller TestsDickey-Fuller Tests
Or: [POr: [PGG(t) - MC(t) - MCG G ] = b* [P] = b* [PGG(t-1) - MC(t-1) - MCG G ] + WN(t)] + WN(t)
PPGG(t) = MC(t) = MCG G + b* P + b* PGG(t-1) - b*MC(t-1) - b*MCG G + WN(t) + WN(t)
PPGG(t) = (1-b)*MC(t) = (1-b)*MCG G + b* P + b* PGG(t-1) (t-1) + WN(t) + WN(t)
subtract Psubtract PGG(t-1) (t-1)
PPGG(t) - P(t) - PGG(t-1) = (1-b)*MC(t-1) = (1-b)*MCG G + b* P + b* PGG(t-1) (t-1) - P - PGG(t-(t-1) + WN(t)1) + WN(t)
or or PPGG(t) = (1-b)*MC(t) = (1-b)*MCG G + (1-b)* P + (1-b)* PGG(t-1) + WN(t)(t-1) + WN(t) Now there is an intercept as well as a slopeNow there is an intercept as well as a slope
67
67
68
68
69
69Augmented Dickey- Augmented Dickey- Fuller TestsFuller Tests
70
70ARTWO’s and Unit RootsARTWO’s and Unit Roots Recall the edge of the triangle of stability: bRecall the edge of the triangle of stability: b2 2 = 1 – = 1 –
bb1 1 , so for stability b, so for stability b1 1 + b+ b2 2 < 1< 1 x(t) = bx(t) = b1 1 x(t-1) + bx(t-1) + b2 2 x(t-2) + wn(t)x(t-2) + wn(t) Subtract x(t-1) from both sidesSubtract x(t-1) from both sides x(t) – x(-1) = (bx(t) – x(-1) = (b1 1 – 1)x(t-1) + b– 1)x(t-1) + b2 2 x(t-2) + wn(t)x(t-2) + wn(t) Add and subtract bAdd and subtract b2 2 x(t-1) from the right side: x(t-1) from the right side: x(t) – x(-1) = (bx(t) – x(-1) = (b1 1 + b+ b2 2 - 1) x(t-1) - b- 1) x(t-1) - b2 2 [x(t-1) - x(t-2)] + [x(t-1) - x(t-2)] +
wn(t)wn(t) Null hypothesis: (bNull hypothesis: (b1 1 + b+ b2 2 - 1) = 0- 1) = 0 Alternative hypothesis: (bAlternative hypothesis: (b1 1 + b+ b2 2 -1)<0-1)<0
71
71Part III. Spring 2002 Part III. Spring 2002 MidtermMidterm
72
72
73
73
74
74
75
75
76
76
20
40
60
80
100
120
55 60 65 70 75 80 85 90 95 00
HELPADS
Figure 4.1 T race of Index of Help Wanted Advertis ing in Newspapers
77
77
78
78
0
10
20
30
40
50
30 40 50 60 70 80 90 100
Series: HELPADSSample 1951:01 2002:03Observations 615
Mean 66.00325Median 67.00000Maximum 106.0000Minimum 24.00000Std. Dev. 21.92956Skewness -0.080022Kurtosis 1.845852
Jarque-Bera 34.79036Probability 0.000000
Figure 4.2 Histogram/Moments of Index of Help Wanted Advertising
79
79
80
80Figure 4.4 Dickey-Fuller Unit Root Test for Index of Help Wanted Advertising in Newspapers
ADF Test Statistic -1.354785 1% Critical Value* -3.4434 5% Critical Value -2.8666 10% Critical Value -2.5695
*MacKinnon critical values for rejection of hypothesis of a unit root.
Augmented Dickey-Fuller Test EquationDependent Variable: D(HELPADS)Method: Least Squares
Sample(adjusted): 1951:02 2002:03Included observations: 614 after adjusting endpoints
Variable Coefficient Std. Error t-Statistic Prob.
HELPADS(-1) -0.005467 0.004036 -1.354785 0.1760C 0.370819 0.280790 1.320631 0.1871
R-squared 0.002990 Mean dependent var 0.009772Adjusted R-squared 0.001361 S.D. dependent var 2.192952S.E. of regression 2.191459 Akaike info criterion 4.410265Sum squared resid 2939.127 Schwarz criterion 4.424662Log likelihood -1351.951 F-statistic 1.835442Durbin-Watson stat 1.929455 Prob(F-statistic) 0.175986
----------------------------------------------------------------------------------------------------------------------
81
81
82
82
-0.15
-0.10
-0.05
0.00
0.05
0.10
55 60 65 70 75 80 85 90 95 00
DLNHELP
Figure 5.1 Trace of Fractional Change in Index of Help Wanted Ads, dlnhelp
83
83
0
20
40
60
80
100
120
140
-0.10 -0.05 0.00 0.05 0.10
Series: DLNHELPSample 1951:02 2002:03Observations 614
Mean 0.000228Median 0.000000Maximum 0.091567Minimum -0.125880Std. Dev. 0.033695Skewness -0.372063Kurtosis 3.617305
Jarque-Bera 23.91501Probability 0.000006
Figure 5.2 Histogram/Moments of Fractional Change in Index of Help Wanted Ads
84
84
85
85
Figure 5.4 Dickey-Fuller Unit Root Test for Fractional Changes in the index of Help Wanted Ads
ADF Test Statistic -20.72793 1% Critical Value* -3.4435 5% Critical Value -2.8666 10% Critical Value -2.5695
*MacKinnon critical values for rejection of hypothesis of a unit root.
Augmented Dickey-Fuller Test EquationDependent Variable: D(DLNHELP)Method: Least Squares
Sample(adjusted): 1951:03 2002:03Included observations: 613 after adjusting endpoints
Variable Coefficient Std. Error t-Statistic Prob.
DLNHELP(-1) -0.825640 0.039832 -20.72793 0.0000C 0.000142 0.001342 0.105719 0.9158
R-squared 0.412865 Mean dependent var -7.54E-05Adjusted R-squared 0.411904 S.D. dependent var 0.043316S.E. of regression 0.033218 Akaike info criterion -3.968176Sum squared resid 0.674210 Schwarz criterion -3.953761Log likelihood 1218.246 F-statistic 429.6470Durbin-Watson stat 2.113546 Prob(F-statistic) 0.000000
86
86