How to use egarch on a ts (in OSX)
stock.ba
is a ts
object of monthly stock returns and I would like to fit an eGARCH model, but I keep getting this error using a new download of rgarch
in R 2.10.1:
> stock.ba.egarch <- ugarchfit(stock.ba, spec)
Error in UseMethod("ugarchfit") :
no applicable method for 'ugarchfit' applied to开发者_JAVA百科 an object of class "ts"
Here's the (relevant) code
stock.ba <- window(stock, start=c(1831, 1), end=c(2010, 2))
spec <- ugarchspec(variance.model = list(model = "eGARCH"))
stock.ba.egarch <- ugarchfit(stock.ba, spec)
Thanks!
Got a fix from the library-writer! I had to unclass the ts:
stock.ba.egarch <- ugarchfit(spec=spec, data=unclass(stock.ba))
I was also being a little casual with my argument placement (as a result of a few unsuccessful iterations).
精彩评论