Computer Lab Session 2 ARIMA, ARCH and GARCH Models

Similar documents
Chapter 4 Level of Volatility in the Indian Stock Market

THE UNIVERSITY OF CHICAGO Graduate School of Business Business 41202, Spring Quarter 2003, Mr. Ruey S. Tsay

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

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

Conditional Heteroscedasticity

Economics 413: Economic Forecast and Analysis Department of Economics, Finance and Legal Studies University of Alabama

Modelling Stock Market Return Volatility: Evidence from India

GARCH Models. Instructor: G. William Schwert

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

INTERNATIONAL JOURNAL OF ADVANCED RESEARCH IN ENGINEERING AND TECHNOLOGY (IJARET)

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

Variance clustering. Two motivations, volatility clustering, and implied volatility

STAT758. Final Project. Time series analysis of daily exchange rate between the British Pound and the. US dollar (GBP/USD)

Time series analysis on return of spot gold price

MODELING VOLATILITY OF BSE SECTORAL INDICES

Financial Econometrics Jeffrey R. Russell Midterm 2014

Financial Econometrics

Determinants of Stock Prices in Ghana

MODELING EXCHANGE RATE VOLATILITY OF UZBEK SUM BY USING ARCH FAMILY MODELS

Research Article The Volatility of the Index of Shanghai Stock Market Research Based on ARCH and Its Extended Forms

Modelling volatility - ARCH and GARCH models

US HFCS Price Forecasting Using Seasonal ARIMA Model

Financial Econometrics: Problem Set # 3 Solutions

Model Construction & Forecast Based Portfolio Allocation:

Modeling Philippine Stock Exchange Composite Index Using Time Series Analysis

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

Market Risk Management for Financial Institutions Based on GARCH Family Models

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

Lecture 5a: ARCH Models

Volatility Analysis of Nepalese Stock Market

Modeling Exchange Rate Volatility using APARCH Models

An Empirical Research on Chinese Stock Market Volatility Based. on Garch

ARIMA ANALYSIS WITH INTERVENTIONS / OUTLIERS

Graduate School of Business, University of Chicago Business 41202, Spring Quarter 2007, Mr. Ruey S. Tsay. Midterm

STOCK MARKET EFFICIENCY, NON-LINEARITY AND THIN TRADING EFFECTS IN SOME SELECTED COMPANIES IN GHANA

INFORMATION EFFICIENCY HYPOTHESIS THE FINANCIAL VOLATILITY IN THE CZECH REPUBLIC CASE

Forecasting Financial Markets. Time Series Analysis

The Analysis of ICBC Stock Based on ARMA-GARCH Model

This homework assignment uses the material on pages ( A moving average ).

477/577 In-class Exercise 3 : Fitting ARMA(p,q)

CHAPTER III METHODOLOGY

Univariate Time Series Analysis of Forecasting Asset Prices

Financial Time Series Analysis (FTSA)

Lecture Note: Analysis of Financial Time Series Spring 2008, Ruey S. Tsay. Seasonal Time Series: TS with periodic patterns and useful in

The University of Chicago, Booth School of Business Business 41202, Spring Quarter 2009, Mr. Ruey S. Tsay. Solutions to Final Exam

A Predictive Model for Monthly Currency in Circulation in Ghana

Modeling Volatility of Price of Some Selected Agricultural Products in Ethiopia: ARIMA-GARCH Applications

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

Indian Institute of Management Calcutta. Working Paper Series. WPS No. 797 March Implied Volatility and Predictability of GARCH Models

Modeling Volatility Clustering of Bank Index: An Empirical Study of BankNifty

Case Study: Predicting U.S. Saving Behavior after the 2008 Financial Crisis (proposed solution)

Empirical Study on Short-Term Prediction of Shanghai Composite Index Based on ARMA Model

University of New South Wales Semester 1, Economics 4201 and Homework #2 Due on Tuesday 3/29 (20% penalty per day late)

Per Capita Housing Starts: Forecasting and the Effects of Interest Rate

Forecasting the Philippine Stock Exchange Index using Time Series Analysis Box-Jenkins

Time series: Variance modelling

VOLATILITY OF SELECT SECTORAL INDICES OF INDIAN STOCK MARKET: A STUDY

Oil Price Effects on Exchange Rate and Price Level: The Case of South Korea

Amath 546/Econ 589 Univariate GARCH Models

Modelling Rates of Inflation in Ghana: An Application of Arch Models

The University of Chicago, Booth School of Business Business 41202, Spring Quarter 2010, Mr. Ruey S. Tsay Solutions to Final Exam

ARCH modeling of the returns of first bank of Nigeria

Modeling and Forecasting Consumer Price Index (Case of Rwanda)

Econometric Models for the Analysis of Financial Portfolios

Forecasting Exchange Rate between Thai Baht and the US Dollar Using Time Series Analysis

Homework Assignments for BusAdm 713: Business Forecasting Methods. Assignment 1: Introduction to forecasting, Review of regression

Financial Econometrics Jeffrey R. Russell. Midterm 2014 Suggested Solutions. TA: B. B. Deng

An Empirical Research on Chinese Stock Market and International Stock Market Volatility

ARCH and GARCH models

International Trade and Finance Association SEASONALITY IN ASIA S EMERGING MARKETS: INDIA AND MALAYSIA

Statistical Analysis of Data from the Stock Markets. UiO-STK4510 Autumn 2015

LAMPIRAN. Null Hypothesis: LO has a unit root Exogenous: Constant Lag Length: 1 (Automatic based on SIC, MAXLAG=13)

International Journal of Business and Administration Research Review. Vol.3, Issue.22, April-June Page 1

Forecasting short term interest rates using ARMA, ARMA-GARCH and ARMA-EGARCH models

The Relationship between Inflation, Inflation Uncertainty and Output Growth in India

Yafu Zhao Department of Economics East Carolina University M.S. Research Paper. Abstract

Barter and Business Cycles: A Comment and Further Empirical Evidence

Computer Lab Session 3 The Generalized Linear Regression Model

DATABASE AND RESEARCH METHODOLOGY

Forecasting the Volatility in Financial Assets using Conditional Variance Models

Financial Data Analysis, WS08/09. Roman Liesenfeld, University of Kiel 1

Financial Econometrics Notes. Kevin Sheppard University of Oxford

Brief Sketch of Solutions: Tutorial 2. 2) graphs. 3) unit root tests

THE PENNSYLVANIA STATE UNIVERSITY SCHREYER HONORS COLLEGE DEPARTMENT OF STATISTICS ALVIN KAPIL. Spring 2012

The Great Moderation Flattens Fat Tails: Disappearing Leptokurtosis

Inflation and inflation uncertainty in Argentina,

Properties of financail time series GARCH(p,q) models Risk premium and ARCH-M models Leverage effects and asymmetric GARCH models.

Lecture Note of Bus 41202, Spring 2017: More Volatility Models. Mr. Ruey Tsay

IS INFLATION VOLATILITY CORRELATED FOR THE US AND CANADA?

LONG MEMORY IN VOLATILITY

A SEARCH FOR A STABLE LONG RUN MONEY DEMAND FUNCTION FOR THE US

ANALYSIS OF THE RELATIONSHIP OF STOCK MARKET WITH EXCHANGE RATE AND SPOT GOLD PRICE OF SRI LANKA

The Impact of Falling Crude Oil Price on Financial Markets of Advanced East Asian Countries

APPENDIX 1. Step by step procedure to be used in EViews

Modelling Stock Returns Volatility on Uganda Securities Exchange

A Comparative Study of Various Forecasting Techniques in Predicting. BSE S&P Sensex

The Relationship between Inflation and Inflation Uncertainty: Evidence from the Turkish Economy

Prerequisites for modeling price and return data series for the Bucharest Stock Exchange

Graduate School of Business, University of Chicago Business 41202, Spring Quarter 2007, Mr. Ruey S. Tsay. Solutions to Final Exam

MODELING NIGERIA S CONSUMER PRICE INDEX USING ARIMA MODEL

Transcription:

JBS Advanced Quantitative Research Methods Module MPO-1A Lent 2010 Thilo Klein http://thiloklein.de Contents Computer Lab Session 2 ARIMA, ARCH and GARCH Models Exercise 1. Estimation of a quarterly ARMA model of the US Producer Price Index (PPI)... 2 Exercise 2. ARMA model selection... 3 Exercise 3. Seasonality and ARIMA modeling... 4 Exercise 4. GARCH model of US PPI... 4 Exercise 5. GARCH-M... 5 Exercise 6. GARCH and TARCH models... 6 Exercise 7. GARCH models... 6

Exercise 1. Estimation of a quarterly ARMA model of the US Producer Price Index (PPI) Use quarterly.csv. a) Plot the PPI in level and first difference. Are these sequences stationary? b) Take logs and first difference of PPI (the resulting variable is a measure of what?). Plot again and compute ACF and PACF and do ADF test. Why is it important to take logs? Has the variable a unit root? c) What kind of model suggests the ACF and PACF? What happens with the PAC and PACF at lag 4? What could be the explanation? d) Estimate an ARMA(p,q), for the following cases (p,q)=(1,0), (2,0), (1,1), (1,(1,4)) ((1,4) means a MA term at lags 1 and 4), (2,1), (1,(0,4)). For each of these models report SSR, AIC and Q(5), Q(10) and Q(15). Which is the best model? Does this model pass all the diagnostic tests (Normality, no autocorrelation, no ARCH terms)? e) Estimate the ARMA models (p,q)=(1,1) and (1,(1,4)) over the period 1960.1-1989.3. Obtain the one-step-ahead forecast (static forecast in R) and the one-step-ahead forecast error from each. Evaluate the forecast performance of these models. Solution: p.87-93 Enders (2004). a) Generate first difference of log(ppi) and plot the series LPPI <- ts(log(ppi), start=c(1960, 1), freq=4) LPPI.d1 <- diff(lppi, lag=1, differences=1) par(mfrow=c(2,1)); plot(lppi); plot(lppi.d1) Answer: The first is for sure not stationary, the second one maybe. b) The autocorrelation and partial autocorrelation decay quickly: it seems to be a stationary series: acf(lppi.d1); pacf(lppi.d1) ADF test (without trend!!) lets us reject the null hypothesis that LPPI.d1 has a unit root. The series is stationary. library(tseries) adf.test.1(lppi.d1, kind=2, k=2) adf.test.2(lppi.d1, L=2, int=t, trend=f) It is important to take logs because the resulting variable is a measure of inflation. c) It could be an AR process, since the PACF decay more quickly than the ACF. It could also be an ARMA process, since up to lag 4 the PACs are significant (and then do not decay so quickly). Note that the autocorrelation of order 4 is measuring the correlation between observations for same quarters of different years. This is reflecting some kind of seasonality. Many economic time series tend to exhibit seasonality. For example, people spend more money in Christmas than in any other time of the year, and normally the Christmas expenditure is correlated with how much we spent last year (the expenditure in the same quarter of previous year). And of course the same happens with prices. d) Model SSR AIC Q(5), Q(10), Q(15) AR(1) 0.021057-1026.62 13.17, 24.34, 26.80 AR(2) 0.020138-1031.1 8.43, 17.93, 20.99 ARMA(1,1) 0.013351-1036.24 4.99, 14.50, 17.40

ARMA(2,1) 0.019601-1033.63 4.93, 14.45, 17.38 ARMA(1,(1,4)) 0.012312-1038.29 2.67, 9.30, 12.25 ARMA(1,(0,4)) 0.019691-1033.07 4.84, 13.03, 15.96 The ARMA(1,(1,4)) seems to fit our data best, it has the lowest SSR, AIC and Ljung- Box statistics. Let us now run some diagnostic tests on the model residuals. Autocorrelation. Ljung-Box statistic: Is there any evidence of autocorrelation up to lag 5, 10 and 15? No, there isn t! library(ccgarch) nna <- is.na(arma1d$res)==f ljung.box.test(arma1d$res[nna]) Normality. Jarque-Bera test for the null of normality: There is evidence of nonnormality. We reject the null hypothesis of normal distributed residuals. We should improve our model! jarque.bera.test(arma1d$res[nna]) ARCH terms. ARCH LM test: We reject the hypothesis of no autocorrelation of the squared residuals, i.e. there is evidence of ARCH behaviour (heteroskedasticity, the conditional variance is not constant). This could also explain the non-normality result. We will learn about how to model this phenomenon. library(fints) ArchTest(c(arma1d$res), lags=2) e) Select the training sample over the period 1960.1-1989.3. LPPI.d1.w <- window(lppi.d1, start=c(1960,1), end=c(1989,3)) Use generic function predict() to obtain the one-step-ahead forecast and the one-stepahead forecast error. predict(arma1e.11, n.ahead=1) We find that the forecast error is lower for the ARMA(1,(1,4)) model and the point forecast of this model is also closer to the actual observation: window(lppi.d1, c(1989,4), c(1989,4)) Exercise 2. ARMA model selection Use arima.csv. Choose the best model for each variable (y1,,y7) applying the modified Box-Jenkins methodology. Do it step by step reporting the results at each step. Solution: For The best model is: Original process: y 1 AR(1) yt 0.9 yt 1 t y2 ARMA(1) yt 0.9 yt 1 t y 3 AR(2) yt 0.9 yt 1 0.2 yt 2 t y 4 White noise yt t y 5 MA(1) yt t 0.9 t 1 y 6 MA(2) yt t 0.9 t 1 0.8 t 2 y 7 ARMA(1,1) yt 0.9 yt 1 t 0.8 t 1

Exercise 3. Seasonality and ARIMA modeling Use quarterly.csv, we want to find the best seasonal ARIMA model for money (money defined as M1) (M1NSA series). a) Plot the M1NSA in level and first difference. Are these sequences stationary? b) Take logs and first difference of MINSA (the resulting variable is a measure of money growth). Plot again and compute ACF and PACF. What happens at lags 4, 8, 12, etc? c) Take a seasonal difference (over the first differenced series) and compute again ACF and PACF, what can you observe now? d) What kind of model suggests the ACF and PACF? e) Estimate a SARIMA(1,1,0)(0,1,1) and a SARIMA(0,1,1)(0,1,1). What is the best model? (Important: sometimes it is not necessary the regular difference, it will be enough with a seasonal difference; so as rule of thumb first take the seasonal difference and then first regular difference only if needed.) Solution: p.95-99 Enders (2004). (D4DLM1NSA is the seasonal difference of the first difference of log(m1nsa)) Exercise 4. GARCH model of US PPI In exercise 1, we saw that there is evidence of conditional heteroscedasticity after fitting an ARIMA model to this data. Let s try now to model the variance of the process (use quarterly.csv). a) Formally test for ARCH errors (using the residuals from the ARIMA model). b) Use the ACF and PACF of the squared residuals as an indication of the order of the GARCH process. How many ARCH terms seem to be needed? Estimate the model. c) Test again for remaining ARCH terms (and compute again ACF and PACF). What can you conclude? Observe carefully the estimated coefficients, what problems do you identify? d) Estimate now a GARCH(1,1), do you still have the same problems? Tabulate ACF and PACF and test for autocorrelation up to lag 4 in squared residuals. e) Produce one-step-ahead forecast with this model. Solution: See also Enders (2004) p. 123-126. a) First estimate an ARMA(1,(1,4)) for the mean (from the lab session we know that this is the best model for this time series). arma4a <- arma(lppi.d1, lag=list(ar=1,ma=c(1,4))); summary(arma1d) Plot the residuals of this estimation: plot(arma4a$res) It seems that the residuals have a non-constant variance. Formally test it with an ARCH LM test with null hypothesis H0: No autocorrelation in squared residuals up to order 4. library(fints) ArchTest(c(arma4a$res), lags=4)

The test statistic n R 2 is Chi-squared with 4 degrees of freedom. We reject the null. Then proceed to estimate an ARCH model for the variance. b) As for the mean, the ACF and PACF will give you information about what kind of GARCH(p,q) could be the best model, i.e. they could indicate the p and the q. (remember GARCH models are in some sense ARMA models for the variance). Let us try an ARCH(4) model for the variance. To do this, we first need to install the rgarch package (follow the description on my website). Then load the package, specify mean and variance equation, and run the joint mean and variance model. library(rgarch) spec <- ugarchspec( variance.model = list(model = "fgarch", submodel = "GARCH", garchorder = c(4,0)), mean.model = list(armaorder = c(1,4), include.mean = F), fixed.pars = list(ma2 = 0,ma3 = 0) ) sgarch.fit <- ugarchfit(data=c(lppi.d1), spec = spec); sgarch.fit c) MA(4) term is not significant and ARCH effects still remain. d) Estimate GARCH(1,1) model with mean equation ARMA(1,(1,4)) spec <- ugarchspec(variance.model = list(model = "fgarch", submodel = "GARCH", garchorder = c(1,1)), mean.model = list(armaorder = c(1,4), include.mean = T), fixed.pars = list(ma2 = 0,ma3 = 0)) Verify that the correlogram of squared residuals is clean. Do ARCH LM test again. ArchTest(sgarch.fit@fit$resid, lags=4) It could be a problem at lag 4. But we can t reject the null of no autocorrelation in the squared residuals up to lag 4. We do not proceed further here. You should improve the model to clean the arch effects further. e) A one-step-ahead forecast can be had by setting n.ahead to 1. Let us see what happens with 200 steps ahead. ugarchforecast(sgarch.fit, n.ahead=200) As time goes on, the forecast tends to the long run mean and variance of the process. Exercise 5. GARCH-M Use arch.csv. a) Estimate an ARIMA model for the series ym (return on a portfolio) following Box- Jenkins methodology. Why might someone conclude that the residuals appear to be white noise? b) Perform the LM test for ARCH errors. c) Estimate an ARCH-M process (using the standard deviation in the mean equation), with an ARCH(1) for the variance. d) Check the ACF and the PACF. Do they appear to be satisfactory? Try other formulations for the ARCH-M process. Interpret the coefficient of the std. dev. in the mean equation. Solution a) You should estimate a MA(3,6). arma5a <- arima(lppi.d1.w, order=c(0,0,6), fixed=c(0, 0, NA, 0, 0, NA, NA)) One might conclude that the residuals appear to be white noise because there is no autocorrelation left on residuals. But the residuals are not normal and they present conditional heteroskedasticity. b) Heteroskedasticity Test: ARCH ArchTest(arma5a$resid, lags=4) We reject the null of no autocorrelation in squared residuals.

c) Now estimate an ARCH(1) variance model and choose garchinmean=t and inmeantype=1 to obtain an ARCH-M with the standard deviation in the mean equation. spec <- ugarchspec(variance.model = list(model = "fgarch", submodel = "GARCH", garchorder = c(1,0)), mean.model = list(armaorder = c(0,6), garchinmean = T, inmeantype = 1), fixed.pars = list(ma1 = 0, ma2 = 0, ma4 = 0, ma5 = 0)) An ARCH test indicates that we still have significant correlation in squared residuals. d) Try to improve the model estimating now a GARCH(1,1) for the variance, and eliminating the term MA(3). Then we have a better model with low correlations in standardized residuals and squared standardized residuals. Exercise 6. GARCH and TARCH models The file NYSE.xls contain the daily values of the New York Stock Exchange Composite Index. Reproduce the results of section 10, chapter 3 of Enders (2004) (ignore the IGARCH estimation subsection). Exercise 7. GARCH models Use garch.csv. The variables, Ret, Inf, dtbill, are the S&P Composite index return, the US inflation rate, and the first difference of the three-month Treasury bill rate. The mean equation has the following form Ret=c+b 1 Ret(-1)+b 2 Inf(-1)+b 3 dtbill(-1)+ a) Test for ARCH terms in the squared residuals from this equation (and plot the ACF and PACF of the squared residual). b) Try to model the heteroskedasticity using: GARCH and TARCH models. c) Which model seems to be the best one? Justify your answer. Solution a) Test for ARCH terms in the squared residuals from this equation (and plot the ACF and PACF of the squared residual) garch.ts <-ts.union(ret=ts(garch$ret),inf=ts(garch$inf),dtbill=ts(garch$dtbill)) lm7 <- dynlm(ret ~ L(ret,1) + L(inf,1) + L(dtbill,1), data=garch.ts) The ARCH test results strongly suggest the presence of ARCH in the residuals. We reject the null of no serial correlation of order one. ArchTest(lm7$resid, lags=4) The correlogram shows clearly that there is correlation of order one of residuals squared. par(mfrow=c(2,1)); acf(lm7$resid); pacf(lm7$resid) b) GARCH(1,1) probably is enough to take into account all the autocorrelation on squared residuals. First generate a matrix of external regressors. n <- dim(garch)[1] ret_1 <- c(na, garch$ret[1:(n-1)]) inf_1 <- c(na, garch$inf[1:(n-1)]) dtbill_1 <- c(na, garch$dtbill[1:(n-1)]) ex.reg <- data.frame(ret_1, inf_1, dtbill_1)[2:n,] Then specify and fit the model

spec <- ugarchspec(variance.model = list(model = "fgarch", submodel = "GARCH", garchorder = c(1,1)), mean.model = list(armaorder = c(0,0), external.regressors = ex.reg) ) sgarch.fit <- ugarchfit(data=garch$ret[2:n], spec = spec); sgarch.fit Note that the parameters verify the conditions for stationarity of the conditional variance (they are both >0 and the sum is <1). A correlogram of the residuals squared shows that now the correlogram is clean. You can also test formally for additional ARCH terms. In fact an ARCH(1) is enough to generate a clean correlogram. Therefore this could be as well an acceptable model. TARCH. Even thought the previous model seems to be good, we can try to see if there are some asymmetric responses to negative and positive shocks. The command is the same as for the GARCH, except that we would now choose: submodel="tgarch" Because the term gamma11, which is, is significant it seems that there are indeed asymmetric responses of the conditional variance to positive and negative shocks. c) The second model can imply a negative conditional variance if the shock was positive and large enough in period t-1 (note that has a positive coefficient). And of course a variance can only be positive. Asymmetric effects seem to be in place, therefore GARCH(1,1) seems satisfactory. We could proceed further and try to fit another asymmetric GARCH model, for example an EGARCH. Source: Exercises 4 to 6 are modified versions of Enders (2004) exercises (chapter 3).