Zhang, Yuhan
2009-Jun-19 15:06 UTC
[R] using garchFit() to fit ARMA+GARCH model with exogeneous variables
Hello - Here's what I'm trying to do. I want to fit a time series y with ARMA(1,1) + GARCH(1,1), there are also an exogeneous variable x which I wish to include, so the whole equation looks like: y_t - \phi y_{t-1} = \sigma_t \epsilon_t + \theta \sigma_{t-1} \epsilon_{t-1} + c x_t where \epsilon_t are i.i.d. random variables \sigma_t^2 = omega + \alpha \sigma_{t-1}^2 + \beta y_{t-1}^2 I looked through documentation of garchFit() from the fGarch library but didn't find a way to include exogeneous variables like x_t. How do I do that? Thank you very much in advance! Yuhan Zhang Morgan Stanley | Fixed Income 1585 Broadway, 3rd Floor | New York, NY 10036 Phone: +1 212 761-2313 Yuhan.Zhang@morganstanley.com -------------------------------------------------------------------------- This is not an offer (or solicitation of an offer) to bu...{{dropped:24}}
spencerg
2009-Jul-01 21:31 UTC
[R] using garchFit() to fit ARMA+GARCH model with exogeneous variables
Hello, Yuhan: If I wanted to get something sensible today, I'd do ordinary least squares using lm(y~x), the garchFit on the residuals. This will give you a reasonable answer except that the confidence intervals from "lm" will not be accurate. I'd want to do normal probability plots of the residuals and whitened residuals. Then I might also do a Monte Carlo to evaluate the distribution of paramter estim If I wanted to go beyond this, I might write my own likelihood function and use, e.g., the maxLik package to get the MLEs, etc. However before I did that, I would do a more careful search of capabilities in contributed packages, something like the following: library(RSiteSearch) # to search help pages of contributed packagee gar <- RSiteSearch.function('GARCH') # for GARCH HTML(gar) # to display the results in a web browser ar <- RSiteSearch.function('ARMA') # Search for ARMA ari <- RSiteSearch.function('ARIMA') # or ARIMA ar. <- ar|ari # for help pages containing either ARMA or ARIMA ar.gar <- ar.&gar # for help pages containing both ARMA / ARIMA and GARCH summary(ar.gar) # to display the packages ArG <- PackageSum2(ar.gar) # for a summary with more detail on installed packages write.csv(ArG, 'ArG.csv') # written to a CSV file where it can more easily be displayed and modified, e.g., in MS Excel HTML(ar.gar) # To display the results in a web browser. This search did not produce much for me, which is part of the reason I suggested maxLik. Hope this helps. Spencer Graves Zhang, Yuhan wrote:> Hello - > > Here's what I'm trying to do. I want to fit a time series y with > ARMA(1,1) + GARCH(1,1), there are also an exogeneous variable x which I > wish to include, so the whole equation looks like: > > y_t - \phi y_{t-1} = \sigma_t \epsilon_t + \theta \sigma_{t-1} > \epsilon_{t-1} + c x_t where \epsilon_t are i.i.d. random > variables > > \sigma_t^2 = omega + \alpha \sigma_{t-1}^2 + \beta y_{t-1}^2 > > > I looked through documentation of garchFit() from the fGarch library but > didn't find a way to include exogeneous variables like x_t. How do I do > that? Thank you very much in advance! > > Yuhan Zhang > Morgan Stanley | Fixed Income > 1585 Broadway, 3rd Floor | New York, NY 10036 > Phone: +1 212 761-2313 > Yuhan.Zhang at morganstanley.com > > > > -------------------------------------------------------------------------- > This is not an offer (or solicitation of an offer) to bu...{{dropped:24}} > > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > >