Economics 584 Computer Lab #2 Suggested Solutions

Similar documents
Forecasting Using Eviews 2.0: An Overview

Forecasting the US Dollar / Euro Exchange rate Using ARMA Models

Time Series Analysis

Time Series Analysis

Chapter 6: Multivariate Cointegration Analysis

Air passenger departures forecast models A technical note

Some useful concepts in univariate time series analysis

IMPACT OF WORKING CAPITAL MANAGEMENT ON PROFITABILITY

Advanced Forecasting Techniques and Models: ARIMA

Vector Time Series Model Representations and Analysis with XploRe

3.1 Stationary Processes and Mean Reversion

2. Linear regression with multiple regressors

Price volatility in the silver spot market: An empirical study using Garch applications

Time Series Analysis

Module 5: Multiple Regression Analysis

Overview of Violations of the Basic Assumptions in the Classical Normal Linear Regression Model

Please follow the directions once you locate the Stata software in your computer. Room 114 (Business Lab) has computers with Stata software

Lecture 2: ARMA(p,q) models (part 3)

Time Series Analysis

The VAR models discussed so fare are appropriate for modeling I(0) data, like asset returns or growth rates of macroeconomic time series.

European Journal of Business and Management ISSN (Paper) ISSN (Online) Vol.5, No.30, 2013

STATISTICA Formula Guide: Logistic Regression. Table of Contents

2. Descriptive statistics in EViews

Determinants of Stock Market Performance in Pakistan

1 Short Introduction to Time Series

Data analysis and regression in Stata

Predictability of Non-Linear Trading Rules in the US Stock Market Chong & Lam 2010

Univariate Time Series Analysis; ARIMA Models

Non-Stationary Time Series andunitroottests

Source engine marketing: A preliminary empirical analysis of web search data

THE UNIVERSITY OF CHICAGO, Booth School of Business Business 41202, Spring Quarter 2014, Mr. Ruey S. Tsay. Solutions to Homework Assignment #2

Booth School of Business, University of Chicago Business 41202, Spring Quarter 2015, Mr. Ruey S. Tsay. Solutions to Midterm

5. Multiple regression

Univariate Time Series Analysis; ARIMA Models

Technical Efficiency Accounting for Environmental Influence in the Japanese Gas Market

Luciano Rispoli Department of Economics, Mathematics and Statistics Birkbeck College (University of London)

The Relationship between Life Insurance and Economic Growth: Evidence from India

Corporate Defaults and Large Macroeconomic Shocks

ITSM-R Reference Manual

TIME SERIES ANALYSIS

Univariate and Multivariate Methods PEARSON. Addison Wesley

TEMPORAL CAUSAL RELATIONSHIP BETWEEN STOCK MARKET CAPITALIZATION, TRADE OPENNESS AND REAL GDP: EVIDENCE FROM THAILAND

Sales forecasting # 2

Performing Unit Root Tests in EViews. Unit Root Testing

STAFF WORKING PAPER. The Relationship between Sustainable Growth and the Riskfree Rate: Evidence from UK Government Gilts. Staff Working Paper 2012.

Forecasting Chilean Industrial Production and Sales with Automated Procedures 1

TIME SERIES ANALYSIS

The relationship between stock market parameters and interbank lending market: an empirical evidence

Data Analysis Tools. Tools for Summarizing Data

Causes of Inflation in the Iranian Economy

Competition as an Effective Tool in Developing Social Marketing Programs: Driving Behavior Change through Online Activities

The Impact of Privatization in Insurance Industry on Insurance Efficiency in Iran

How To Run Statistical Tests in Excel

Is the Forward Exchange Rate a Useful Indicator of the Future Exchange Rate?

Analysis and Computation for Finance Time Series - An Introduction

Financial TIme Series Analysis: Part II

Module 6: Introduction to Time Series Forecasting

Sacred Heart University John F. Welch College of Business

Chapter 5: Bivariate Cointegration Analysis

LAB 4 INSTRUCTIONS CONFIDENCE INTERVALS AND HYPOTHESIS TESTING

Forecasting in STATA: Tools and Tricks

A Trading Strategy Based on the Lead-Lag Relationship of Spot and Futures Prices of the S&P 500

Forecasting of Paddy Production in Sri Lanka: A Time Series Analysis using ARIMA Model

1. What is the critical value for this 95% confidence interval? CV = z.025 = invnorm(0.025) = 1.96

business statistics using Excel OXFORD UNIVERSITY PRESS Glyn Davis & Branko Pecar

Institute of Actuaries of India Subject CT3 Probability and Mathematical Statistics

PRICING OF FOREIGN CURRENCY OPTIONS IN THE SERBIAN MARKET

Imputing Missing Data using SAS

Turkey s Energy Demand

A Guide to Using EViews with Using Econometrics: A Practical Guide

FORECAST MODEL USING ARIMA FOR STOCK PRICES OF AUTOMOBILE SECTOR. Aloysius Edward. 1, JyothiManoj. 2

Chapter 9: Serial Correlation

Testing for Granger causality between stock prices and economic growth

International Statistical Institute, 56th Session, 2007: Phil Everson

16 : Demand Forecasting

PITFALLS IN TIME SERIES ANALYSIS. Cliff Hurvich Stern School, NYU

NCSS Statistical Software Principal Components Regression. In ordinary least squares, the regression coefficients are estimated using the formula ( )

Monitoring web traffic source effectiveness with Google Analytics An experiment with time series

Missing Data: Part 1 What to Do? Carol B. Thompson Johns Hopkins Biostatistics Center SON Brown Bag 3/20/13

Is the Basis of the Stock Index Futures Markets Nonlinear?

Forecasting Stock Market Series. with ARIMA Model

Chapter 1. Vector autoregressions. 1.1 VARs and the identi cation problem

2013 MBA Jump Start Program. Statistics Module Part 3

Simple linear regression

Lesson19: Comparing Predictive Accuracy of two Forecasts: Th. Diebold-Mariano Test

Sensex Realized Volatility Index

Simple Linear Regression Inference

NCSS Statistical Software

Some Essential Statistics The Lure of Statistics

The Orthogonal Response of Stock Returns to Dividend Yield and Price-to-Earnings Innovations

Spillover effects among gold, stocks, and bonds

Sales forecasting # 1

Factors affecting online sales

Time series Forecasting using Holt-Winters Exponential Smoothing

The SAS Time Series Forecasting System

Java Modules for Time Series Analysis

SAS Software to Fit the Generalized Linear Model

Examples. David Ruppert. April 25, Cornell University. Statistics for Financial Engineering: Some R. Examples. David Ruppert.

This unit will lay the groundwork for later units where the students will extend this knowledge to quadratic and exponential functions.

Forecasting the PhDs-Output of the Higher Education System of Pakistan

Transcription:

Department of Economics Eric Zivot University of Washington Spring 6 Economics 584 Computer Lab # Suggested Solutions Empirical Exercises Comparing forecasting models Simulated values from the model y y y iid N t = 1. t 1.4 t + εt, εt ~ (,(.5) ) y = y = 1 are illustrated below. 3 1-1 - -3 5 5 75 1 15 15 175 5 5 Y The series looks stationary with a high degree of persistence (note: the sum of the AR coefficients is.8). The SACF and PACF are illustrated below.

Date: 5/4/5 Time: 9:6 Sample: 1 5 Included observations: 5 Autocorrelation Partial Correlation AC PAC Q-Stat Prob. *******. ******* 1.94.94 6.59.. ****** ***..738 -.431 344.76.. ****.. 3.565.6 46... ***.. 4.44.65 47... ***. * 5.334.11 5.96.. ** *. 6.7 -.93 519.84.. ** *. 7.1 -.69 531.3.. *.. 8.145 -.6 536.7.. *.. 9.84.15 538.57... *. 1.6 -.64 538.75..... 11 -. -.17 538.88..... 1 -.55.7 539.69. The SACF decays geometrically to zero and the PACF cuts off at lag. This is consistent with an AR() model. Descriptive statistics are given below 16 1 8 4-3 - -1 1 Series: Y Sample 1 5 Observations 5 Mean -.58697 Median -.35574 Maximum.531798 Minimum -.916817 Std. Dev. 1.86649 Skewness -.66333 Kurtosis.577 Jarque-Bera 9.53879 Probability.8519

The mean is close to zero. Interestingly, the JB statistic rejects normality for the data. This could be due to the fact that the JB statistic was designed for iid data. 3. Using the first observations to fit the AR() model gives Dependent Variable: Y Method: Least Squares Date: 5/4/5 Time: 9:1 Sample (adjusted): 3 Included observations: 198 after adjustments Convergence achieved after 3 iterations Variable Coefficient Std. Error t-statistic Prob. C.4171.4487.167769.8669 AR(1) 1.3754.6353.951. AR() -.47386.6377-7.43491. R-squared.853581 Mean dependent var.471 Adjusted R-squared.8579 S.D. dependent var 1.39917 S.E. of regression.538 Akaike info criterion 1.481761 Sum squared resid 49.49381 Schwarz criterion 1.531583 Log likelihood -143.6943 F-statistic 568.3973 Durbin-Watson stat 1.9585 Prob(F-statistic). Inverted AR Roots.66-.18i.66+.18i The estimated results are similar to the actual values. The inverted roots of the characteristic polynomial ˆ( φ z) = 1 1.38z+.474z = are complex and have modulus inside the complex unit circle so that the fitted model is stationary and ergodic. The plot of the actual, fitted and residuals indicate that the model tracks the simulated data well. The correlogram of the residuals (not shown) reveals no omitted serial correlation.

4 1 - -4-1 - 5 5 75 1 15 15 175 Residual Actual Fitted 4. Using the first observations to fit a mis-specified MA(1) gives Dependent Variable: Y Method: Least Squares Date: 5/4/5 Time: 9:3 Sample: 1 Included observations: Convergence achieved after 13 iterations Backcast: Variable Coefficient Std. Error t-statistic Prob. C.49147.1946.47745.6336 MA(1).84146.3971 1.46. R-squared.633518 Mean dependent var.46649 Adjusted R-squared.631667 S.D. dependent var 1.3336 S.E. of regression.79994 Akaike info criterion.378897 Sum squared resid 13.889 Schwarz criterion.41188 Log likelihood -35.8897 F-statistic 34.76 Durbin-Watson stat.783957 Prob(F-statistic). Inverted MA Roots -.84

The MA coefficient is close to one which is required to capture the large first order sample autocorrelation. The small DW statistic indicates omitted positive serial correlation in the residuals. The SACF and PACF of the residuals (not shown) indicates omitted serial correlation. The modified Q-statistics are large for all lags. The plot of the actual, fitted and residuals below indicates that the model does not track the simulated data as well as the AR() model. 3 1 1-1 -1 - -3 - -3 5 5 75 1 15 15 175 Residual Actual Fitted 5. Forecasts from the rolling 1-step ahead forecasts from the AR() and MA(1) are displayed in the tables below. Forecast: YF AR Actual: Y Forecast sample: 1 5 Included observations: 5 Root Mean Squared Error.49495 Mean Absolute Error.411 Mean Absolute Percentage Error 15.4196 Theil Inequality Coefficient.18 Bias Proportion.586 Variance Proportion.356 Covariance Proportion.944139

Forecast: YF MA1 Actual: Y Forecast sample: 1 5 Included observations: 5 Root Mean Squared Error.746679 Mean Absolute Error.63343 Mean Absolute Percentage Error 17.985 Theil Inequality Coefficient.47445 Bias Proportion.155979 Variance Proportion.5477 Covariance Proportion.319314 The RMSE and RAE are both smaller for the AR() model indicating a superior fit. 6. To statistically compare the forecasting accuracy of the AR() and MA(1) models, we may compute Diebold-Mariano (DM) statistics using the squared error and absolute error loss functions. The DM statistics are based on the following loss differentials d d MA1 AR ( ˆ ε ) ( ˆ ε ) sq, t = t t = ˆ ε ˆ ε MA1 AR abs, t t t computed using the rolling 1-step ahead forecast errors from the AR() and MA(1) models, respectively. A time plot of these loss differentials are shown below

3..5. 1.5 1..5. -.5-1. 5 1 15 5 3 35 4 45 5 D DABS In general both loss differentials are positive indicating that the MA(1) model produces a larger forecast error than the AR() model. The DM statistic DM = d SE ( d ) may be computed by regressing the loss differential on a constant and choosing the NW correction to the standard error. Dependent Variable: D Method: Least Squares Date: 5/4/5 Time: 9:53 Sample: 1 5 Included observations: 5 Newey-West HAC Standard Errors & Covariance (lag truncation=3) Variable Coefficient Std. Error t-statistic Prob. C.316.13399 3.337.4

Dependent Variable: DABS Method: Least Squares Date: 5/4/5 Time: 1:1 Sample: 1 5 Included observations: 5 Newey-West HAC Standard Errors & Covariance (lag truncation=3) Variable Coefficient Std. Error t-statistic Prob. C.113.66393 3.17858.6 The DM statistic has an asymptotic standard normal distribution. Using both the squared and absolute value loss functions we reject the null hypothesis that the AR() and MA(1) models have equally forecasting accuracy. Since the t-statistics are positive we conclude that the AR() model is more accurate than the MA(1) model. Working with State Space Models In this exercise, a simple AR() model is estimated by conditional MLE and by exact MLE via state space methods. The AR() model has the form y y y iid N t = φ1 t 1+ φ t + εt, εt ~ (, σ ) The model is fit to detrended quarterly observations on log real GDP over the period 1947:1 through 1999:4, and then dynamic forecasts are produced over the period 1:1 through 3:4. Q1 and Q. The conditional MLEs for the AR() are produced using the following Eviews commands LS dtlrgdp ar(1) ar() and are given in the table below.

Dependent Variable: DTLRGDP Method: Least Squares Date: 5/4/5 Time: 1:4 Sample (adjusted): 1947Q3 1999Q4 Included observations: 1 after adjustments Convergence achieved after 3 iterations Variable Coefficient Std. Error t-statistic Prob. AR(1) 1.311783.6467.341. AR() -.358569.644-5.56591. R-squared.945366 Mean dependent var.55 Adjusted R-squared.94513 S.D. dependent var.4677 S.E. of regression.9531 Akaike info criterion -6.45911 Sum squared resid.18894 Schwarz criterion -6.4735 Log likelihood 68.68 Durbin-Watson stat.78946 Inverted AR Roots.9.39 3. The exact MLEs for the AR() are produced by first creating a state space form. The Kalman filter is used to create the prediction error decomposition of the log-likelihood, and this likelihood is maximized to give the MLEs. The state space set up allows for the marginal likelihood to be created for the first two initial values. In Eviews, the state space form for the AR() model (without a constant) is @signal dtlrgdp = sv1 @state sv1 = c()*sv1(-1) + c(3)*sv(-1) + [var = exp(c(1))] @state sv = sv1(-1) The coefficient c(1) denotes the variance of the error term, c() denotes the first AR term and c(3) denotes the second AR term. Notice that there is no constant in the specification because we are modeling the detrended data. The exact MLEs are

Sspace: SSAR Method: Maximum likelihood (Marquardt) Date: 5/4/5 Time: 1:54 Sample: 1947Q1 1999Q4 Included observations: 1 Estimation settings: tol=.1, derivs=accurate numeric Initial Values: C(1)=., C()=1.31777, C(3)=-.36195 Convergence achieved after 7 iterations Coefficient Std. Error z-statistic Prob. C(1) -9.313497.7384-17.4359. C() 1.31768.55531 3.7799. C(3) -.361841.5758-6.944. Final State Root MSE z-statistic Prob. SV1 -.518.9497 -.539963.589 SV -.8845. NA. Log likelihood 684.837 Akaike info criterion -6.4347 Parameters 3 Schwarz criterion -6.38498 Diffuse priors Hannan-Quinn criter. -6.4139 The exact MLEs are close the conditional MLEs. The estimate of the standard deviation of the error term is sqrt(exp(-9.313497)) =.9497 which is close to the standard error of the regression reported in the conditional MLE output. The exact log-likelihood is slightly higher than the conditional log-likelihood. Remark: Good starting values are important for the estimation of state space models. By default, for nonlinear least squares type problems, EViews uses the values in the coefficient vector at the time you begin the estimation procedure as starting values. If you wish to change the starting values, first make certain that the spreadsheet view of the coefficient vector is in edit mode, then enter the coefficient values. When you are finished setting the initial values, close the coefficient vector window and estimate your model. You may also set starting coefficient values from the command window using the

PARAM command. Simply enter the PARAM keyword, followed by pairs of coefficients and their desired values: param c(1) 153 c().68 c(3).15 sets C(1)=153, C()=.68, and C(3)=.15. All of the other elements of the coefficient vector are left unchanged. The forecasts from the state space model, the conditional AR() and the actual values are illustrated below. Notice that the forecasts from the state space model are essentially identical to those from the conditional AR() model..1. -.1 -. -.3 -.4 -.5 -.6 1 3 4 DTLRGDP DTLRGDPF DTLRGDPF_AR 4. The filtered estimates of the state vector from the state space model are illustrated below.

Filtered State SV1 Estimate Filtered State SV Estimate.1.1.8.8.4.4.. -.4 -.4 -.8 -.8 -.1 5 55 6 65 7 75 8 85 9 95 -.1 5 55 6 65 7 75 8 85 9 95 SV1 ± RMSE SV ± RMSE For the AR() model, the first state variable is y(t) and the second state variable is y(t-1). Estimate Simple Unobserved Components Model 1. The state space representation for the Clark model is @signal lrgdp*1 = sv1 + sv @state sv1 = c(1) + sv1(-1) + [var = exp(c())] @state sv = c(3)*sv(-1) + c(4)*sv3(-1) + [var = exp(c(5))] @state sv3 = sv(-1) To improve numerical stability, the log of real GDP is multiplied by 1. This is done so that the derivatives of the log-likelihood are more closely scaled. The starting values for the estimation are set using param c(1) c() -1 c(3) 1. c(4) -.4 c(5) -1 The MLEs are given in the table below Sspace: SSCLARK Method: Maximum likelihood (Marquardt) Date: 5/3/5 Time: 11:59 Sample: 1947Q1 3Q4 Included observations: 8 Estimation settings: tol=.1, derivs=accurate numeric

Initial Values: C(1)=., C()=-1., C(3)=1., C(4)= -.4, C(5)=-1. Convergence achieved after iterations Coefficient Std. Error z-statistic Prob. C(1).8618.46946 17.59837. C() -1.3773.663-1.869559.615 C(3) 1.441194.13548 1.6375. C(4) -.493771.137166-3.59989.3 C(5) -.644815.45481-1.417796.1563 Final State Root MSE z-statistic Prob. SV1 98.768.34589 396.7918. SV -1.33.311634 -.4451.6583 SV3-1.189.77786 -.536437.5917 Log likelihood -35.196 Akaike info criterion.896458 Parameters 5 Schwarz criterion.971663 Diffuse priors 3 Hannan-Quinn criter..9681 The MLEs for the AR coefficients are 1.441 and -.494, respectively. The roots of the characteristic equation φ ( z) = 1 1.441z+.494z = are 1.779 and 1.137, respectively. Since these values are greater than 1, the AR component is covariance stationary. The variance of the permanent component is.95, and the variance of the transitory component is.5476. Notice that the transitory component has a higher variance than the permanent component. The ratio of the permanent component variance to the stationary component variance is.553 indicating that the stationary component is almost twice as important as the permanent component for explaining the variation of log real GDP. The filtered state estimates are given below

96 Filtered State SV1 Estimate 15 Filtered State SV Estimate 15 Filtered State SV3 Estimate 9 1 1 88 5 5 84 8-5 -5 76-1 -1 7 5 55 6 65 7 75 8 85 9 95-15 5 55 6 65 7 75 8 85 9 95-15 5 55 6 65 7 75 8 85 9 95 SV1 ± RMSE SV ± RMSE SV3 ± RMSE Notice that the filtered trend estimate is very close to a linear trend, and the filtered state estimates are very similar to the filtered estimates of the AR() for the linearly detrended data. The graphs have been modified since the initial states are not estimated very precisely, and this results in very large SE values that distort the graphs. The filtered cycle state without the SE bars and omitting the initial state estimates is illustrated below. This model shows boom periods during the late 6s and late 9s, with recessions in the late 5s, mid 7s, early 8s, early 9s and early s. 6 4 - -4-6 -8 5 55 6 65 7 75 8 85 9 95 SVF The 1-step ahead response (signal) is given below. Notice that the Clark model tracks actual output fairly well.

96 One-step-ahead LRGDP*1 Signal Prediction 9 88 84 8 76 7 5 55 6 65 7 75 8 85 9 95 LRGDP*1 ± RMSE