Questions: (1) Which model is the best? How can you tell? (2) Do the standard errors need to be adjusted for heteroskedasticity? If so, how would you do it? (3) What are the mean square error and mean absolute error of the model for the level of the series? (4) What is the level and forecast volatility for the next 12 months? (5) Analyze your forecast and explain any issues that may arise? (Hint: think in terms of the model equation.) (6) Do you think this model provides a good forecast for mortgage rates? Explain?
FIN 666 Assignment #4 Purpose: Analyze a univariate forecast of 30-year mortgage rates using the ARCH family of models. Task:Using stata, the lecture material and the mortg.dta data file fit ARCH(1), GARCH(1,1), TGARCH(1,1,1), and ARCH-in-Means(1) models and with the best one predict the mortgage level and volatility for the next 12 months. You will also determine if the standard errors need to be adjusted for heteroskedasticity and calculate the mean square error and mean absolute error for the best model. Directions:Find the best ARCH family model from the list above using mortg.dta, determine if standard errors need to be adjusted and take appropriate action, predict mortgage rate level and volatility for the next 12 months, calculate the fit of the forecast level and answer the following questions. mortg.dtaData file with market return data needed for assignment Provide the stata output, do file and log smcl file with the completed assignment and answer all questions. Questions:(1)Which model is the best? How can you tell? (2)Do the standard errors need to be adjusted for heteroskedasticity? If so, how would you do it? (3)What are the mean square error and mean absolute error of the model for the level of the series? (4) What is the level and forecast volatility for the next 12 months? (5) Analyze your forecast and explain any issues that may arise? (Hint: think in terms of the model equation.) (6) Do you think this model provides a good forecast for mortgage rates? Explain? Page 1 of 1 Arch Model Selection log using "ARCH model selection.smcl", replace use sp500.dta, replace// Fama & French rf and mktrf factors gen sp500 = rf + mktrf// add risk free rate and market risk premium to get S&P return ****************************************** * time series must be dense i.e. no gaps * * or missing observations!!!! * ****************************************** gen datem = mofd(dateff)// use generate monthly date variable from daily date label var datem " " format datem %tm tsset datem global lastobs = datem in l// last tsset value in data tsline sp500// graph S&P 500 returns hist sp500, normal// histogram of returns with normal overlay sktest sp500// test normality reg sp500// run bare regression estat archlm, lags(1)// Engle's LM test for ARCH effects ************************* * Let's look at ARCH(1) * ************************* arch sp500, arch(1) nolog// ARCH(1) predict e, resid// residuals predict v, variance// variance gen s = sqrt(v)// standard deviation gen se = e/s// standardized residuals gen se2 = se^2// squared standardized residuals wntestq se2// portmanteau test for white noise wntestb se2, table// Bartlett's test for white noise wntestb se2// cumulative periodogram graph corrgram se2// correlegram gives the ac and pacs ************************************************************************ * No remaining ARCH...BUT, what about normality? * * NOTE: If your ARCH model is optimal, the resulting squared residuals * * from the ARCH models should look like a white noise process * * (ACF/PACF, Q2(m) statistics, portmanteau and other tests) * ************************************************************************ hist se, normal sktest se// test normality of standardized residuals arch sp500, arch(1) nolog robust// ARCH(1) robust ************************************************************************ * NOTE: alpha0 > 0, alpha1 >= 0 so conditional variance is nonnegative * * HOWEVER alpha1 = 0 (p=0.194) so conditional variance is * * constant and e is therefore conditionally homoskedastic * ************************************************************************ estat ic// information criterion * drop temporary variables drop e v s se se2 ************************** * Now look at GARCH(1,1) * ************************** arch sp500, arch(1) garch(1) nolog// GARCH(1,1) predict e, resid// residuals predict v, variance// variance gen s = sqrt(v)// standard deviation gen se = e/s// standardized residuals gen se2 = se^2// squared standardized residuals wntestq se2// portmanteau test for white noise corrgram se2// correlegram gives the ac and pacs hist se, normal// histogram of standardized residuals with normal overlay sktest se// test normality of residuals * NOTE: residuals not normal so use robust errors arch sp500, arch(1) garch(1) nolog robust// GARCH(1,1) robust estat ic// information criterion * drop temporary variables drop e v s se se2 ***************************** * Now look at TGARCH(1,1,1) * ***************************** arch sp500, arch(1) garch(1) tarch(1) nolog // TGARCH(1,1,1) predict e, resid// residuals predict v, variance// variance gen s = sqrt(v)// standard deviation gen se = e/s// standardized residuals gen se2 = se^2// squared standardized residuals wntestq se2// portmanteau test for white noise corrgram se2// correlegram gives the ac and pacs sktest se// test normality of residuals arch sp500, arch(1) garch(1) tarch(1) nolog robust // TGARCH(1,1,1) robust estat ic// information criterion * NOTE: GARCH(1,1) better than TGARCH(1,1,1) according to information criterion * drop temporary variables drop e v s se se2 * Now look at GARCH-in-means(1,1) arch sp500, archm arch(1) garch(1) nolog robust// GARCH(1,1) robust estat ic// information criterion * NOTE: GARCH(1,1) better than GARCH-in-means(1,1) according to information criterion arch sp500, arch(1) garch(1) nolog robust// GARCH(1,1) robust * Look at one year out-of sample forecast tsappend, add(12) * predict predict yhat, xb label var yhat "GARCH(1,1) predicted return" * predict volatility (variance) predict htarch, variance dynamic($lastobs + 1) label var htarch "GARCH(1,1) predicted volatility" tsline htarch * plot market returns again tsline sp500 yhat, saving(sp500, replace) * plot GARCH(1,1) mean and volaltility tsline htarch, saving(htarch, replace) * combine graphs graph combine sp500.gph htarch.gph, cols(1) saving(arch, replace) title("GARCH(1,1) Model") gen err = yhat - sp500 label var err "Error" gen sqerr = (yhat - sp500)^2 label var sqerr "Squared error" gen aberr = abs(yhat - sp500) label var aberr "Absolute error" gen pcterr = err / sp500 *********************************************************************************** * NOTE: pcterr doesn't mean much here since we are calculating a conditional mean * * which doesn't change therefor the pct errors will "look" large * *********************************************************************************** label var pcterr "Percent error" mean err sqerr aberr pcterr * list forecasted predicted values list datem sp500 yhat htarch in -24/l log close ARCH Lab log using "ARCH Lab", replace use returns, clear * ------------------------------------------------ * Create dates and declare time series -- method 1 * ------------------------------------------------ gen month = mod(_n-1,12) + 1 egen year = seq(), f(1988) t(2004) b(12) gen date = ym(year,month) format %tm date tsset date * ------------------------------------------------ * Create dates and declare time series -- method 2 * ------------------------------------------------ drop date gen date = m(1988m1) + _n - 1 format date %tm tsset date * ------------------------------------------------ * Time series plots and histograms * ------------------------------------------------ tsline rus, yline(0) more tsline roz, yline(0) more tsline rjap, yline(0) more tsline rhk, yline(0) more histogram rus, normal more histogram roz, normal more histogram rjap, normal more histogram rhk, normal more * ---------------------------------------------- * Load byd, create dates and declare time series * ---------------------------------------------- use byd, clear gen time = _n tsset time tsline r, yline(0) more * ---------------------------------------------- * LM test for ARCH(1) * ---------------------------------------------- regress r predict ehat, residual gen ehat2 = ehat * ehat regress ehat2 L.ehat2 scalar NR2 = e(N)*e(r2) scalar pvalue = chi2tail(1,NR2) scalar list NR2 pvalue * ---------------------------------------------- * Built-in LM Test for ARCH(1) * ---------------------------------------------- regress r estat archlm, lags(1) * ---------------------------------------------- * ARCH(1) * ---------------------------------------------- arch r, arch(1) nolog estat ic predict htarch, variance label var htarch "ARCH conditional variance" predict mean, xb label var mean "ARCH mean prediction" sum mean htarch tsline htarch mean more * ---------------------------------------------- * GARCH(1,1) * ---------------------------------------------- arch r, arch(1) garch(1) nolog estat ic predict htgarch, variance label var htgarch "GARCH conditional variance" predict gmean, xb label var gmean "GARCH mean prediction" sum gmean htgarch tsline htgarch gmean more * ---------------------------------------------- * Threshold GARCH * ---------------------------------------------- arch r, arch(1) garch(1) tarch(1) nolog estat ic predict httgarch, variance label var httgarch "TGARCH conditional variance" predict tmean, xb label var tmean "TGARCH mean prediction" sum tmean httgarch tsline httgarch tmean more * ---------------------------------------------- * TGARCH-in-mean * ---------------------------------------------- arch r, archm arch(1) garch(1) tarch(1) nolog estat ic predict htmgarch, variance label var htmgarch "TGARCHM conditional variance" predict tmmean, xb label var tmmean "TGARCHM mean prediction" sum tmmean htmgarch tsline htmgarch tmmean more sum r mean gmean tmean tmmean htarch htgarch httgarch htmgarch label var r "BYD returns" hist r, normal hist tmmean, normal log close ARCH Example use market, clear gen ret = mktrf + rf label var ret "Market return" gen datem = mofd(dateff) label var datem "Numeric (monthly) date" format datem %tm * tsset on the dense time-series variable tsset datem * need to determine the last tsset value in data global lastobs = datem in l * histogram of returns histogram ret, normal more * time-series of returns tsline ret, yline(0) more * test for ARCH() effects regress ret estat archlm, lags(1 2 3 4) * estimate using ARCH model arch ret, arch(1) estat ic * examine residuals predict e, resid// residuals predict v, variance// variance gen s = sqrt(v)// standard deviation gen se = e/s// standardized residuals gen se2 = se^2// squared standardized residuals wntestq se2// test squared residuals for white noise corrgram se2// correlegram gives the ac and pacs more sktest se// test normality of standardized residuals arch ret, arch(1) robust// adjust standard errors due to non-normality * add data line for next 12 periods tsappend, add(12) * predict mean predict yarch, y dynamic($lastobs + 1) label var yarch "ARCH predicted return" * predict volatility (variance) predict htarch, variance dynamic($lastobs + 1) label var htarch "ARCH predicted volatility" * plot market returns again tsline ret, yline(0) saving(ret, replace) * plot ARCH(1) volaltility tsline htarch, saving(htarch, replace) * combine graphs graph combine ret.gph htarch.gph, cols(1) saving(arch, replace) title("ARCH Model") * Calculate prediction errors gen err = yarch - ret label var err "Forecast error" gen sqerr = (yarch - ret)^2 label var sqerr "Squared error" gen aberr = abs(yarch - ret) label var aberr "Absolute error" sum err sqerr aberr * calculate actual mean, standard deviation & variance of series for comparison egen meanret = mean(ret) labe var meanret "Mean of return" egen sigma = sd(ret) labe var sigma "Standard deviation of return" gen sigmasq = sigma^2 labe var sigma "Variance of return" * look at actual and predicted values last 24 months list datem ret sigmasq meanret yarch htarch in -24/l capture log close exit Sheet1 2000-01-018.211/1/00 2000-02-018.332/1/00 2000-03-018.243/1/00 2000-04-018.154/1/00 2000-05-018.525/1/00 2000-06-018.296/1/00 2000-07-018.157/1/00 2000-08-018.038/1/00 2000-09-017.919/1/00 2000-10-017.810/1/00 2000-11-017.7511/1/00 2000-12-017.3812/1/00 2001-01-017.031/1/01 2001-02-017.052/1/01 2001-03-016.953/1/01 2001-04-017.084/1/01 2001-05-017.155/1/01 2001-06-017.166/1/01 2001-07-017.137/1/01 2001-08-016.958/1/01 2001-09-016.829/1/01 2001-10-016.6210/1/01 2001-11-016.6611/1/01 2001-12-017.0712/1/01 2002-01-0171/1/02 2002-02-016.892/1/02 2002-03-017.013/1/02 2002-04-016.994/1/02 2002-05-016.815/1/02 2002-06-016.656/1/02 2002-07-016.497/1/02 2002-08-016