An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-sig-finance/attachments/20130923/32d4fac5/attachment.pl>
rugarch by processing with plyr
2 messages · Geoffrey Smith, Alexios Ghalanos
Why would they? You have fixed them in the spec (data$XVAR) and are only rolling the YVAR (which is the same for both subjects) by subject. You probably want: ddply(data, 'SUBJECT', function(x) coef(ugarchfit(ugarchspec(mean.model=list(armaOrder=c(0,0), external.regressors=data.matrix(x$XVAR)),variance.model=list(model='eGARCH')), data=x$YVAR, solver='hybrid'))) Regards, Alexios
On 23/09/2013 20:43, Geoffrey Smith wrote:
I would like to estimate an EGARCH model by subject using the rugarch and
plyr packages. I am concerned that the external regressors named in the
ugarchspec function do not roll forward by subject. For example, in the
code below, both subjects have the exact same dependent variables, but
different independent variables. Yet, the parameter estimates for both
subjects are the exact same. I think this is due to the independent
variables not changing by subject. Am I correct? If so, how can I work
around this? Thank you very much.
library(plyr)
library(rugarch)
set.seed(1000)
Y <- rnorm(200)
data <- data.frame(SUBJECT=c(rep('Alice', 200), rep('Bart', 200)),
YVAR=rep(Y, 02), XVAR=rnorm(400))
data
spec <- ugarchspec(mean.model=list(armaOrder=c(00,00),
external.regressors=data.matrix(data$XVAR), include.mean=TRUE),
variance.model=list(model='eGARCH', garchOrder=c(01,01)),
distribution.model='norm')
ddply(data, .(SUBJECT), function(x) coef(ugarchfit(spec=spec,
data=x$YVAR, solver='hybrid')))
[[alternative HTML version deleted]]
_______________________________________________ R-SIG-Finance at r-project.org 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.