Garch fitting of financial data in R programming

Feb 3rd, 2012
Studypool Tutor
Manchester College
Course: Mathematics
Price: $35 USD

Tutor description

This document provides a simple example of how to fit Garch models in a financial data. The paper calculates log returns of the data before fitting and testing the data using L-jung Box test. The student should enhance understanding of the codes by trying the process using a different set of data.

Word Count: 403
Showing Page: 1/5
library(fBasics)library(moments)library(fGarch)setwd("C:/Users/D/Desktop/project")eabll=read.csv("Book1.csv",header=TRUE);eablleabl=na.omit(eabll);eableablrt=eabl$EABL;eablrtlogrt=log(eablrt);logrt#a#mean of the log returnsmean(logrt) [1] 5.035465Mean not equal to zero#b#skewness of log returnsskewness(logrt)[1] 0.6705608The data is positively skewed.#c#kurtosis of log returnskurtosis(logrt)[1] 4.862654#since kurtosis is greater than three hence it is a leptokurtic showing it has an excess kurtosis with a fat tail.#dBox.test(logrt,lag=10,type='Ljung') Box-Ljung testdata: logrtX-squared = 21327.56, df = 10, p-value < 2.2e-16#commentP value is small hence heteroscedastic with no dependency.#e#acf plotacf(logrt)acf(logrt^2)#(f)#fitting GARCH(1,1) model with Gaussian inovationsfitmodel=garchFit(~garch(1,1),data=logrt,cond.dist ="norm",trace=F)summary(fitmodel)#outputStandardised Residuals Tests: Statistic p-Value Jarque-Bera Test R Chi^2 5419785 0 Shapiro-Wilk Test R W 0.5737438 0 Ljung-Box Test R Q(10) 6767.593 0 Ljung-Box Test R Q(15) 9797.003 0 Ljung-Box Test R Q(20) 12652.83 0 Ljung-Box Test R^2 Q(10) 0.05045615 1 Ljung-Box Test R^2 Q(15) 0.07463037 1 Ljung-Box Test R^2 Q(20) 0.1045167 1 LM Arch Test R TR^2 0.05965995 1 Information Criterion Statistics:

Review from student

Studypool Student
" Goes above and beyond expectations ! "
Ask your homework questions. Receive quality answers!

Type your question here (or upload an image)

1829 tutors are online

Brown University





1271 Tutors

California Institute of Technology




2131 Tutors

Carnegie Mellon University




982 Tutors

Columbia University





1256 Tutors

Dartmouth University





2113 Tutors

Emory University





2279 Tutors

Harvard University





599 Tutors

Massachusetts Institute of Technology



2319 Tutors

New York University





1645 Tutors

Notre Dam University





1911 Tutors

Oklahoma University





2122 Tutors

Pennsylvania State University





932 Tutors

Princeton University





1211 Tutors

Stanford University





983 Tutors

University of California





1282 Tutors

Oxford University





123 Tutors

Yale University





2325 Tutors