[R-SIG-Finance] Question about rugarch
Andreas Bregiannis
bregiannis.andreas at hotmail.com
Thu Mar 1 17:32:22 CET 2018
Dear Sir or Madam,
I am trying to fit an AR-t-(E)GARCH model in stock log return data using the rugarch package.
My code is :
install.packages("rugarch")
library(rugarch)
data <- read.csv2("C:/Users/bregi/Desktop/Thesis/R/euro.csv",header = TRUE,sep=";")
lr.AEX<- diff(log(data$AEX)) ## log returns of stock market index AEX
egarcht.spec=ugarchspec(variance.model=list(model="eGARCH",garchOrder=c(2,1)),
mean.model=list(armaOrder=c(1,0)),distribution.model = "std")
egarcht.fit = ugarchfit(egarcht.spec, lr.AEX)
The problem is that I want to transform my standardized residuals to follow uniform distribution. But when I run the following:
res<-residuals(egarcht.fit, standardize=TRUE)
ecdf(res)
plot.ecdf(res)
I realized that they have not transformed. I think that I found the problem but I don't know how to fix it.
When I run residuals(egarcht.fit, standardize=TRUE) I get data in the following form:
1970-01-02 01:00:00 -0.3766309 instead of just -0.3766309.
After that, I tried to solve this problem by doing:
require(xts)
time <- date[2:3914]
lrAEX.xts <- na.omit(xts(x = lr.AEX, order.by = time))
egarcht.spec=ugarchspec(variance.model=list(model="eGARCH",garchOrder=c(2,1)),
mean.model=list(armaOrder=c(1,0)),distribution.model = "std")
egarcht.fit = ugarchfit(egarcht.spec, data=lrAEX.xts)
residuals(egarcht.fit,standardize=TRUE)[1]
But the only improvement is that I receive the real dates of my data
[,1]
2001-01-02 -0.3766309
However, my goal is to receive only the residuals ( so only -0.3766309).
Could you please tell me if you know how I can achieve this?
Thank you in advance.
Kind regards,
Andreas
[[alternative HTML version deleted]]
More information about the R-SIG-Finance
mailing list