Milos, If you notice in his spreadsheet, he is using VIX[t-1] (as it should be), but you are passing the ex.reg without lagging it (perhaps this should be made explicit in the documentation).
Pass instead this: >ex.reg=c(0,(vix^2)/252) Also, don't pass data frames, use matrix (or xts) for the external.regressors and numeric for the data (when not using xts). You'll notice the rugarch likelihood is slightly better and the numbers very slightly different. If you plug the rugarch coefficients into his excel spreadsheet you'll get the exact same likelihood. -Alexios On 25/08/2014 04:59, Milos Cipovic wrote: > Hi there, > I was trying to redo in R excel exercises from Peter F. Christoffersen's > book Elements of Financial Risk Management. > > I have different results for problem 3 on page 92 (chapter 4) > You can read it here: > > http://books.google.rs/books?id=YkcMBGYbRasC&printsec=frontcover&dq=Elements+of+Financial+Risk+Management&hl=sr&sa=X&ei=K676U6PEJIb6PKWsgZAD&ved=0CBwQ6AEwAA#v=onepage&q&f=false > > Here is my R code: > > > ################################################# > > library(gdata) > library(rugarch) > # I downloaded data directly from book's companion site# > data=read.xls("http://booksite.elsevier.com/ > 9780123744487/chapter_data_results/ > Chapter4_Results.xls",perl="C:\\Perl64\\bin\\perl.exe", > sheet=3) > # where perl="C:\\Perl64\\bin\\perl.exe" is location of pearl.exe file on > my machine,on your's it may differ # > > sandp=as.data.frame(data[,2]) > > returns=diff(log(sandp)) > > vix=as.data.frame(data[-1,4]) > > #scale to one day > ex.reg=(vix^2)/252 > > spec=ugarchspec(variance.model=list(model="fGARCH",garchOrder=c(1,1),submodel="NAGARCH", > external.regressors=ex.reg),mean.model=list(armaOrder=c(0,0),include.mean=F)) > > result=(ugarchfit(spec,returns)) > > coef(result) > likelihood(result) > > # If you download excel sheet from > http://booksite.elsevier.com/9780123744487/chapter_data_results/Chapter4_Results.xls > #You'll see the difference in results in maximum likelihoods. > #SO,AM I DOING SOMETHING WRONG OR IS THIS JUST A NUMERICAL ERROR?? > #(This may be a amateur question and I apologize for that) but I'm not > shore can I use implied volatility as an external regressor like I did here? > > [[alternative HTML version deleted]] > > _______________________________________________ > [email protected] mailing list > https://stat.ethz.ch/mailman/listinfo/r-sig-finance > -- Subscriber-posting only. If you want to post, subscribe first. > -- Also note that this is not the r-help list where general R questions > should go. > > _______________________________________________ [email protected] mailing list https://stat.ethz.ch/mailman/listinfo/r-sig-finance -- Subscriber-posting only. If you want to post, subscribe first. -- Also note that this is not the r-help list where general R questions should go.
