Garten
Garten

Reputation: 41

Make models from rugarch package to configurate with MuMIn

I am trying to do model averaging and wish to combine models from the rugarch package and model estimated through "lm" function. I use daily financial index data converted into an xts object. Thereby, I run lm functions:

    X<-as.xts(Financial_index_data)

    LM.Result<-lm(X ~ lag(X, -1))

and then I run a GARCH function using rugarch package:

    library(rugarch)

    Garch.spec = ugarchspec(variance.model = list(model="sGARCH", garchOrder = c(1,1)), mean.model = list(armaOrder=c(1,1)), distribution.model = "norm")

    GARCH.Result<- ugarchfit(Garch.spec, X)

In my next step, I want to perform model averaging using MuMIn:

    library(MuMIn)

    MA<-model.avg(LM.Result, GARCH.Result)

And gets the following error: "Error: $ operator not defined for this S4 class"

I understand that rugarch package is not supported by MuMIn package. But is there anyway to transform my regression made in rugarch to an lm class or any model averaging package that supports all kinds of regression?

Upvotes: 1

Views: 112

Answers (1)

Kamil Bartoń
Kamil Bartoń

Reputation: 1562

First of all, you'd need to write either a logLik method or a function to return an information criterion to be used for ranking (model.avg's rank). Additionally, you need to adapt at least these functions: coefTable, getAllTerms, get_call (or use updateable as "uGARCHfit" class does not seem to store a call). Have a look at lm or glm counterparts of these functions (e.g MuMIn:::coefTable.lm).

Upvotes: 0

Related Questions