[R-SIG-Finance] Plot GARCH data using Quantmod

Brian G. Peterson brian at braverock.com
Fri Feb 12 21:37:50 CET 2010


Rich Ghazarian wrote:
> I'm trying to plot a garch fit using quantmod by doing something like this
>  mm <- specifyModel(garchFit(formula = ~ garch(1, 1), data = ngrt1))
>
> and obviously it's not working
>
> My question is what is: What is the quickest way to fit and plot a
> GARCH series that preserves its date and time structure.  If I just do
> something like
> test<-(fitted(garch(ngrt1, order = c(1,1),fitted.values=TRUE)))
> then I lose the date index.
>   
You've specified GARCH functions from two different packages, fGarch and 
tseries.

the ones from tseries are years old at this point, and there are many 
newer GARCH implementations in R, including fGarch.

fGarch has many plotting methods.  Are those not working for you? 

help("plot-methods",package='fGarch')

there are also numerous examples in the garchFit documentation

help("garchFit",package='fGarch')

garchFit will give you timeSeries results, you can plot those using 
chartSeries.  I do it all the time.

specifyModel in quantmod doesn't work the way you seem to think it 
does.  It's not magic.  See the quantmod documentation, quantmod 
website, and the list archives of this thread foor how to use 
specifyModel (you won't use the way your example seems to propose)

Regards,

    - Brian

-- 
Brian G. Peterson
http://braverock.com/brian/
Ph: 773-459-4973
IM: bgpbraverock



More information about the R-SIG-Finance mailing list