[R-SIG-Finance] Question about rugarch

ibrahim ergen ibrahimergen at gmail.com
Thu Mar 1 18:49:50 CET 2018


Standardized residuals would be approx. normally distributed. Those are the shocks. Standardization here means filetering of vol clustering. So you get the garch shocks which are approx normal. You can use pnorm function to transform them to uniform distribution. 

Best
Ibrahim

Sent from my iPhone

> On Mar 1, 2018, at 11:32 AM, Andreas Bregiannis <bregiannis.andreas at hotmail.com> wrote:
> 
> 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]]
> 
> _______________________________________________
> 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.



More information about the R-SIG-Finance mailing list