Select Page

Just follow steps in the instruction using R studio.Both the homework instruction and data required have been attached. I have posted the textbook as well.
hw7.pdf

sdhousepricegr.xlsx

Don't use plagiarized sources. Get Your Custom Essay on
A homework question about forecasting using R language
Just from \$10/Page

Unformatted Attachment Preview

ECON 467
Spring 2019
HW 7
(Due to Shi by 8:30 a.m. on April 1, 2019)
Use the San Diego house price data (data on the growth on the housing prices: G) that I have
posted with this homework. Use the data up to 2008:2 as the estimation sample and the data
in 2008:3 – 2012:2 as the prediction sample.
a. Estimate an AR(4) model of the growth of the housing price in San Diego.
Then using a fixed scheme, make one-period-ahead forecasts based on the model.
Call the forecast FA. The purpose of the exercise is forecast evaluation.
b. Generate a second series of one-period-ahead forecasts that are calculated by
averaging the last two observations. Call it FB.
c. Present a table similar to Table 9.2 in the text book of the two sets of forecasts and
forecast error series along with the actual data.
d. Implement the forecast optimality tests (viz., MPE test, and Information Efficiency
(That is, present tables similar to the ones in Table 9.4 in the text book – excluding
the Linex loss function.) Together with regular t-stat include t-stats based on HAC
standard errors too in the table.
e. Implement a descriptive evaluation of the average loss resulting from the two
forecasts. Use RMSE, MAE and MAPE as the measures of the average loss.
Summarize your results in a table like Table 9.6 (excluding Linex loss function) in
the text book.
f. Now statistically test whether the squared error loss from FB is any different from the
loss from FA. Use both regular standard error and HAC standard error. What is your
conclusion?
g. Consider the following two combination forecasts that combine FA and FB forecasts:
i. using equal weights: call this forecast series CF1
ii. using weights equal to the inverse of the MSEs of the forecasts: CF2
In both cases the weights should add up to 1. What are the MSEs of these two
forecasts based on one-period-ahead forecast errors? Compare these MSEs with the
MSEs of FA and FB above. Do you see any improvement in the performance of the
forecasts?
OBS
1975Q2
1975Q3
1975Q4
1976Q1
1976Q2
1976Q3
1976Q4
1977Q1
1977Q2
1977Q3
1977Q4
1978Q1
1978Q2
1978Q3
1978Q4
1979Q1
1979Q2
1979Q3
1979Q4
1980Q1
1980Q2
1980Q3
1980Q4
1981Q1
1981Q2
1981Q3
1981Q4
1982Q1
1982Q2
1982Q3
1982Q4
1983Q1
1983Q2
1983Q3
1983Q4
1984Q1
1984Q2
1984Q3
1984Q4
1985Q1
1985Q2
1985Q3
1985Q4
1986Q1
1986Q2
1986Q3
1986Q4
1987Q1
1987Q2
1987Q3
1987Q4
G
3.875226
2.784185
3.231245
3.026323
0.800703
3.828554
4.758848
8.321665
6.206399
8.27685
5.84781
4.149952
4.963949
4.376981
6.023289
3.121601
6.391586
3.740141
2.591726
1.817442
1.787449
-2.8481
-10.6003
17.50684
4.861545
-1.97747
-7.0395
4.628838
2.53782
-2.60551
-0.36054
1.718688
0.523817
0.430599
1.50887
0.454257
1.057327
1.195765
0.272555
1.564087
1.481622
1.86904
-1.01614
2.910147
2.000959
2.357219
1.48631
2.107113
2.519729
2.445134
2.276081
1988Q1
1988Q2
1988Q3
1988Q4
1989Q1
1989Q2
1989Q3
1989Q4
1990Q1
1990Q2
1990Q3
1990Q4
1991Q1
1991Q2
1991Q3
1991Q4
1992Q1
1992Q2
1992Q3
1992Q4
1993Q1
1993Q2
1993Q3
1993Q4
1994Q1
1994Q2
1994Q3
1994Q4
1995Q1
1995Q2
1995Q3
1995Q4
1996Q1
1996Q2
1996Q3
1996Q4
1997Q1
1997Q2
1997Q3
1997Q4
1998Q1
1998Q2
1998Q3
1998Q4
1999Q1
1999Q2
1999Q3
1999Q4
2000Q1
2000Q2
2000Q3
2000Q4
2.795112
3.945252
4.448373
6.066199
5.131782
5.39785
3.541867
2.642109
0.765248
0.32053
0.622361
-2.15172
-0.90379
-0.53429
-0.34068
0.290253
-0.2094
-1.2832
-0.4109
-2.03926
-2.58309
-0.58374
-1.63463
-1.20494
0.340854
0.331579
-0.57051
-0.92915
-0.86258
-0.30037
-1.54049
-0.46891
0.915116
0.755921
0.198175
-1.41773
1.997965
2.330914
1.592611
1.507377
3.249282
5.516339
1.711208
0.663682
3.711203
3.768753
2.375707
3.234623
3.432154
5.126509
2.849223
2.672024
2001Q1
2001Q2
2001Q3
2001Q4
2002Q1
2002Q2
2002Q3
2002Q4
2003Q1
2003Q2
2003Q3
2003Q4
2004Q1
2004Q2
2004Q3
2004Q4
2005Q1
2005Q2
2005Q3
2005Q4
2006Q1
2006Q2
2006Q3
2006Q4
2007Q1
2007Q2
2007Q3
2007Q4
2008Q1
2008Q2
2008Q3
2008Q4
2009Q1
2009Q2
2009Q3
2009Q4
2010Q1
2010Q2
2010Q3
2010Q4
2011Q1
2011Q2
2011Q3
2011Q4
2012Q1
2012Q2
3.45
3.348252
3.080927
1.422937
5.092976
7.109088
5.802894
3.151133
3.535192
4.303659
5.612785
3.59723
5.843555
9.546292
3.625518
2.159167
0.516565
3.805385
2.019955
-1.03131
-0.34824
-0.34012
-3.49128
-1.84443
0.618136
-1.16976
-4.9801
-7.42473
-6.93466
-3.43053
-5.04084
-6.61976
-3.59545
3.990836
3.516095
1.2723
0.926239
0.261861
-1.79428
-1.91266
-3.08135
0.686884
-2.40045
-0.95467
1.326932
1.328486
FORECASTING FOR ECONOMICS
Gloria González-Rivera
University of California–Riverside
Boston Columbus Indianapolis New York San Francisco Upper Saddle River Amsterdam
Cape Town Dubai London Madrid Milan Munich Paris Montreal Toronto Delhi
Mexico City Sao Paulo Sydney Hong Kong Seoul Singapore Taipei Tokyo
The Pearson Series in Economics
Abel/Bernanke/Croushore
Chapman
Gregory/Stuart
Macroeconomics*
Environmental Economics:
Theory, Application, and
Policy
Russian and Soviet Economic
Performance and Structure
Cooter/Ulen
Law & Economics
The Economics of Natural
Resource Use
Downs
Heilbroner/Milberg
An Economic Theory of
Democracy
The Making of the Economic Society
Ehrenberg/Smith
The Economic Way of Thinking
Blanchard
Modern Labor Economics
Hoffman/Averett
Macroeconomics*
Ekelund/Ressler/Tollison
Blau/Ferber/Winkler
Economics*
Women and the Economy:
Family, Work, and Pay
The Economics of Women, Men and
Work
Farnham
Holt
Boardman/Greenberg/Vining/
Weimer
Folland/Goodman/Stano
Foundations of Economics*
Berck/Helfand
The Economics of
the Environment
Bierman/Fernandez
Game Theory with
Economic Applications
Economics for Managers
Hartwick/Olewiler
Heyne/Boettke/Prychitko
Markets, Games and Strategic
Behavior
The Economics of Health and Health
Care
Hubbard O’Brien
Cost-Benefit Analysis
Boyer
Fort
Principles of Transportation
Economics
Sports Economics
Money, Banking, and the Financial
System*
Branson
Macroeconomics
Macroeconomic Theory and
Policy
The Structure of American Industry
Bruce
Public Finance and the American
Economy
Carlton/Perloff
Modern Industrial Organization
Case/Fair/Oster
Principles of Economics*
Caves/Frankel/Jones
An Introduction
Froyen
Fusfeld
The Age of the Economist
Gerber
International Economics*
González-Rivera
Forecasting for Economics and
Gordon
Macroeconomics*
Greene
Econometric Analysis
Gregory
Essentials of Economics
Economics*
Hubbard/O’Brien/Rafferty
Macroeconomics*
Hughes/Cain
American Economic History
Husted/Melvin
International Economics
Jehle/Reny
Theory
Johnson-Lans
A Health Economics Primer
Keat/Young
Managerial Economics
Klein
Mathematical Methods
for Economics
Krugman/Obstfeld/Melitz
Nafziger
Sawyer/Sprinkle
International Economics:
Theory & Policy*
The Economics of Developing
Countries
International Economics
Laidler
O’Sullivan/Sheffrin/Perez
The Demand for Money
Economics: Principles, Applications
and Tools*
Industry Structure, Strategy,
and Public Policy
Leeds/von Allmen
Scherer
Schiller
Economics*
The Economics of Poverty and
Discrimination
Perloff
Sherman
Microeconomics*
Market Regulation
Microeconomics: Theory and
Applications with Calculus*
Silberberg
Economic Development: Theory and
Practice for a Divided World
Perman/Common/
McGilvray/Ma
Stock/Watson
Miller
Natural Resources and
Environmental Economics
The Economics of Sports
Leeds/von Allmen/Schiming
Economics*
Lipsey/Ragan/Storer
Economics*
Lynn
Economics Today*
Understanding Modern
Economics
Miller/Benjamin
The Economics of Macro Issues
Miller/Benjamin/North
The Economics of Public
Issues
Mills/Hamilton
Parkin
Principles of Microeconomics
Introduction to
Econometrics
Phelps
Introduction to Econometrics,
Brief Edition
Health Economics
Studenmund
Pindyck/Rubinfeld
Using Econometrics: A
Practical Guide
Microeconomics*
Riddell/Shackelford/Stamos/
Schneider
Economics: A Tool for Critically
Understanding Society
Principles of Money, Banking &
Financial Markets*
Mishkin
Environmental and
Natural
Resource Economics
Environmental Economics
and Policy
Ritter/Silber/Udell
Urban Economics
Tietenberg/Lewis
Todaro/Smith
Economic Development
The Economics of Money,
Banking, and Financial
Markets*
Roberts
The Choice: A Fable of Free Trade
and Protection
Waldman
The Economics of Money,
Banking, and Financial
Rohlf
Waldman/Jensen
Introduction to Economic
Reasoning
Industrial Organization:
Theory and Practice
Ruffin/Gregory
Weil
Principles of Economics
Economic Growth
Sargent
Williamson
Rational Expectations and Inflation
Macroeconomics
Macroeconomics: Policy and
Practice*
Murray
Econometrics: A Modern
Introduction
*denotes
titles
Microeconomics
Editorial Director: Sally Yagan
Editor in Chief: Donna Battista
D’Ambrosio
Editorial Project Manager: Sarah Dumouchelle
Editorial Assistant: Elissa Senra-Sargent
Director of Marketing: Maggie Moylan
Executive Marketing Manager: Lori DeShazo
Marketing Assistant: Kim Lovato
Senior Managing Editor: Nancy H. Fenton
Senior Production Project Manager: Kathryn
Dinovo
Cover Designer: Suzanne Behnke
Creative Director: Jayne Conte
Cover Photo: Andy Z./Shutterstock
Media Director: Susan Schoenberg
Senior Media Producer: Melissa Honig
Supplements Editors: Alison Eusden
and Kathryn Dinovo
Full-Service Project Management: Jouve North
America
Printer/Binder: Courier/Westford
Cover Printer: Lehigh-Phoenix Color/
Hagerstown
Text Font: Times LT Std
Credits and acknowledgments borrowed from other sources and reproduced, with permission, in this
textbook appear on the appropriate page within text.
Manufactured in the United States of America. This publication is protected by Copyright, and permission
should be obtained from the publisher prior to any prohibited reproduction, storage in a retrieval system, or
transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. To
obtain permission(s) to use material from this work, please submit a written request to Pearson Education,
Inc., Permissions Department, One Lake Street, Upper Saddle River, New Jersey 07458, or you may fax
Many of the designations by manufacturers and sellers to distinguish their products are claimed as
trademarks. Where those designations appear in this book, and the publisher was aware of a trademark
claim, the designations have been printed in initial caps or all caps.
González-Rivera, Gloria.
Forecasting for economics and business / Gloria González-Rivera.
p. cm.
ISBN-13: 978-0-13-147493-2
ISBN-10: 0-13-147493-6
1. Economic forecasting. 2. Economic forecasting—United States. I.
Title.
HB3730.G57 2013
338.5’44—dc23
2011049940
10 9 8 7 6 5 4 3 2 1
ISBN 10: 0-13-147493-6
ISBN 13: 978-0-13-147493-2
Vasilios A. Morikis González,
with love
Brief Contents
1
Introduction and Context
2
Review of the Linear Regression Model
24
3
Statistics and Time Series
52
4
Tools of the Forecaster
79
5
Understanding Linear Dependence: A Link to
Economic Models
103
6
Forecasting with Moving Average (MA) Processes
125
7
Forecasting with Autoregressive (AR) Processes
160
8
Forecasting Practice I
202
9
Forecasting Practice II: Assessment of Forecasts
and Combination of Forecasts
224
Forecasting the Long Term: Deterministic
and Stochastic Trends
255
Forecasting with a System of Equations:
Vector Autoregression
293
12
Forecasting the Long Term and the Short Term Jointly
311
13
Forecasting Volatility I
337
14
Forecasting Volatility II
359
15
Financial Applications of Time-Varying Volatility
395
16
Forecasting with Nonlinear Models: An Introduction
413
10
11
1
vii
Contents
Preface
MODULE I
xvi
STATISTICS AND TIME SERIES
CHAPTER 1 Introduction and Context
1
1.1
1
1
2
3
4
4
4
5
5
1.2
1.3
1.4
1.5
1.6
What Is Forecasting?
1.1.1 The First Forecaster in History: The Delphi Oracle
1.1.2 Examples of Modern Forecasts
1.1.3 Definition of Forecasting
1.1.4 Two Types of Forecasts
Who Are the Users of Forecasts?
1.2.1 Firms
1.2.2 Consumers and Investors
1.2.3 Government
Becoming Familiar with Economic Time Series:
Features of a Time Series
1.3.1 Trends
1.3.2 Cycles
1.3.3 Seasonality
Basic Notation and the Objective of the Forecaster
1.4.1 Basic Notation
1.4.2 The Forecaster’s Objective
A Road Map for This Forecasting Book
Resources
6
7
8
9
11
11
12
13
14
Key Words
Exercises
16
17
CHAPTER 2 Review of the Linear Regression Model
24
2.1
2.2
24
27
Conditional Density and Conditional Moments
Linear Regression Model
ix
x
Contents
2.3
2.4
Estimation: Ordinary Least Squares
2.3.2 Linearity and OLS
2.3.3 Assumptions of OLS: The Gauss–Markov Theorem
2.3.4 An Example: House Prices and Interest Rates
Hypothesis Testing in a Regression Model
2.4.1 The t-ratio
2.4.2 The F-test
29
32
33
35
38
41
41
44
Key Words
Appendix
Exercises
46
47
49
CHAPTER 3 Statistics and Time Series
52
3.1
Stochastic Process and Time Series
3.1.1 Stochastic Process
3.1.2 Time Series
3.2 The Interpretation of a Time Average
3.2.1 Stationarity
3.2.2 Useful Transformations of Nonstationary Processes
3.3 A New Tool of Analysis: The Autocorrelation Functions
3.3.1 Partial Autocorrelation
3.3.2 Statistical Tests for Autocorrelation Coefficients
3.4 Conditional Moments and Time Series: What Lies Ahead
54
55
56
57
58
62
65
69
71
73
Key Words
Appendix
Exercises
74
74
76
MODULE II MODELING LINEAR DEPENDENCE
FORECASTING WITH TIME SERIES MODELS
CHAPTER 4 Tools of the Forecaster
79
4.1
80
4.2
4.3
The Information Set
4.1.1 Some Information Sets Are More
Valuable Than Others
4.1.2 Some Time Series Are More Forecastable
Than Others
The Forecast Horizon
4.2.1 Forecasting Environments
The Loss Function
4.3.1 Some Examples of Loss Functions
82
84
84
86
89
91
Contents
4.3.2
4.3.3
Examples
Optimal Forecast: An Introduction
Key Words
Appendix
Exercises
xi
91
93
96
97
98
A PAUSE Where Are We and Where Are We Going?
100
Where Are We Going from Here?
100
102
CHAPTER 5
A Understanding Linear Dependence:
5.1
5.2
5.3
5.4
Price Dynamics: The Cob-Web Model (Beginner Level)
5.1.1 The Effect of Only One Supply Shock
5.1.2 The Effect of Many Supply Shocks
5.1.3 A Further Representation of the Dynamics
in the Cob-Web Model
5.1.4 Simulation of the Model, pt = p*(1 – ) + pt-1 + t ,
and Autocorrelation Function
Portfolio Returns and Nonsynchronous
Asset Prices and the Bid–Ask Bounce
Summary
103
103
105
106
107
109
113
116
121
Key Words
Appendix
Exercises
121
121
123
CHAPTER 6 Forecasting with Moving Average (MA) Processes
125
6.1 A Model with No Dependence: White Noise
6.1.1 What Does This Process Look Like?
6.2 The Wold Decomposition Theorem: The Origin of AR and MA Models
6.2.1 Finite Representation of the Wold Decomposition
6.3 Forecasting with Moving Average Models
6.3.1 MA(1) Process
6.3.2 MA(q) Process
125
126
129
131
133
135
147
Key Words
Appendix
Exercises
157
157
158
xii
Contents
CHAPTER 7 Forecasting with Autoregressive (AR) Processes
160
7.1 Cycles
7.2 Autoregressive Models
7.2.1 The AR(1) Process
7.2.2 AR(2) Process
7.2.3 AR(p) Process
7.2.4 Chain Rule of Forecasting
7.3 Seasonal Cycles
7.3.1 Deterministic and Stochastic Seasonal Cycles
7.3.2 Seasonal ARMA Models
7.3.3 Combining ARMA and Seasonal ARMA Models
162
165
165
173
185
187
188
189
192
197
Key Words
Exercises
200
200
CHAPTER 8 Forecasting Practice I
202
8.1
8.2
202
205
205
8.3
The Data: San Diego House Price Index
Model Selection
8.2.1 Estimation: AR, MA, and ARMA Models
8.2.2 Is the Process Covariance-Stationary,
and Is the Process Invertible?
8.2.3 Are the Residuals White Noise?
8.2.4 Are the Parameters of the Model Statistically Significant?
8.2.5 Is the Model Explaining a Substantial Variation
of the Variable of Interest?
8.2.6 Is It Possible to Select One Model Among Many?
The Forecast
8.3.1 Who Are the Consumers of Forecasts?
8.3.2 Is It Possible To Have Different Forecasts
from the Same Model?
8.3.3 What Is the Most Common Loss Function in Economics
206
209
211
211
212
213
213
215
215
221
Key Words
Exercises
221
222
CHAPTER 9 Forecasting Practice II: Assessment of Forecasts
and Combination of Forecasts
224
9.1
Optimal Forecast
9.1.1 Symmetric and Asymmetric Loss Functions
9.1.2 Testing the Optimality of the Forecast
9.2 Assessment of Forecasts
9.2.1 Descriptive Evaluation of the Average Loss
9.2.2 Statistical Evaluation of the Average Loss
225
225
229
238
239
240
Contents
9.3
Combination of Forecasts
9.3.1 Simple Linear Combinations
9.3.2 Optimal Linear Combinations
Key Words
Appendix
Exercises
A PAUSE
xiii
244
244
245
247
248
250
Where Are We and Where Are We Going?
252
Where Are We Going from Here?
253
CHAPTER 10 Forecasting the Long Term: Deterministic
and Stochastic Trends
255
10.1
10.2
Deterministic Trends
10.1.1 Trend Shapes
10.1.2 Trend Stationarity
10.1.3 Optimal Forecast
Stochastic Trends
10.2.1 Trend Shapes
10.2.2 Stationarity Properties
10.2.3 Optimal Forecast
257
258
261
262
270
270
272
279
Key Words
Exercises
291
291
CHAPTER 11 Forecasting with a System of Equations:
Vector Autoregression
293
11.1
11.2
11.3
11.4
11.5
294
294
299
302
305
What Is Vector Autoregression (VAR)?
Estimation of VAR
Granger Causality
Impulse-Response Functions
Forecasting with VAR
Key Words
Exercises
309
309
CHAPTER 12 Forecasting the Long Term and the
Short Term Jointly
311
12.1
12.2
12.3
315
322
327
Finding a Long-Term Equilibrium Relationship
Quantifying Short-Term Dynamics: Vector Error Correction Model
Constructing the Forecast
Key Words
Exercises
332
332
xiv
Contents
A PAUSE
Where Are We and Where Are We Going?
334
Where We Are Going from Here
335
336
MODULE III
MODELING MORE COMPLEX DEPENDENCE
CHAPTER 13 Forecasting Volatility I
337
13.1
337
337
13.2
13.3
13.4
13.5
Motivation
13.1.1 The World is Concerned About Uncertainty
13.1.2 Volatility Within the Context of Our
Forecasting Problem
13.1.3 Setting the Objective
Time-Varying Dispersion: Empirical Evidence
Is There Time Dependence in Volatility?
What Have We Learned So Far?
Simple Specifications for the Conditional Variance
13.5.1 Rolling Window Volatility
13.5.2 Exponentially Weighted Moving Average
(EWMA) Volatility
339
340
341
345
353
353
354
355
Key Words
Exercises
357
357
CHAPTER 14 Forecasting Volatility II
359
14.1
360
362
368
370
378
380
14.2
The ARCH Family
14.1.1 ARCH(1)
14.1.2 ARCH(p)
14.1.3 GARCH(1,1)
14.1.4 Estimation Issues for the ARCH Family
Realized Volatility
Key Words
Appendix
Exercises
CHAPTER 15
15.1
390
390
393
Financial Applications of Time-Varying
Volatility
Risk Management
15.1.1 Value-at-Risk (VaR)
15.1.2 Expected Shortfall (ES)
395
395
396
400
Contents
xv
15.2 Portfolio Allocation
15.3 Asset Pricing
15.4 Option Pricing
401
404
406
Key Words
Appendix
Exercises
411
411
412
CHAPTER 16 Forecasting with Nonlinear Models:
An Introduction
413
16.1
16.2
16.3
Nonlinear Dependence
16.1.1 What Is It?
16.1.2 Is There Any Evidence of Nonlinear Dynamics in the Data?
16.1.3 Nonlinearity, Correlation, and Dependence
16.1.4 What Have We Learned So Far?
Nonlinear Models: An Introduction
16.2.1 Threshold Autoregressive Models (TAR)
16.2.2 S …