[R-SIG-Finance] Question rugarch VaR plot

alexios ghalanos alexios at 4dscape.com
Wed May 15 13:24:39 CEST 2013


Hi,

1. If you provide a proper xts based data object as an input, then you 
will get a nice chart.
2. If you provide instead a numeric or undated series, then this is 
coerced to xts and assigned an artificial date sequence using :
as.POSIXct(as.Date(seq_along(data), origin="1970-01-01"))
which is probably why you get 1978 in your x-axis.

If you want to customize a VaR plot, you can use/edit the VaRplot 
function which takes as inputs xts based objects. If you do not want to 
use xts, then you are left to code your own plot. rugarch 
documentation/examples provide enough details to show how to extract the 
forecast VaR from the rolling estimation object, and has been discussed 
on this forum numerous times in the past.

Finally, I urge you to follow mailing list etiquette and sign your 
emails with your real name rather than "Private Private". It is only 
polite given that you are asking for help on this forum.

Regards,

Alexios

On 15/05/2013 11:30, Private Private wrote:
> Dear All/Alexios Ghalanos
>
> I have a question concerning the plot method of the ugarchroll class in the
> package rugarch:
>
> 1.) When I plot the VaR of a ugarchroll class, I would like to change the
> x-axis values to the dates corresponding to the log returns I feed ugarchroll
> - how would I do that? I have tried adding additional arguments like: xaxt="n"
>   - but to no avail. Right now the x-axis has values from 1978????
>
> 2.) Much along the same lines, How would I be able to change the default title
> of the plot?
>
> Using the title() function just pastes over the default title and trying to
> use the 'main' property of plot does not work.
>
> My goal is to have the dates on the x-axis reflect the returns that are being
> graphed and also to have a heading which states with GARCH model is being
> used.
>
> I would like have a VaR plot for each GARCH model I fit (ie. iGarch, EGarch)
> and would like the title of the graph to reflect that and perhaps the
> distribution I chose (ie. normal, t, skewed t).
>
>
> Thank you very much for any help you can provide and I am a very grateful user
> of the rugarch package.
>
>
>
>
>
> Code follows and an example of the plot is attached:
>
> library(rugrch)
> data(sp500ret)
>
> spec<-ugarchspec(variance.model = list(model = "sGARCH",
> garchOrder = c(1, 1)),distribution.model = "norm")
>
> roll<-ugarchroll(spec,data=data[,3],n.ahead = 1,
> 	forecast.length = 100,refit.every=60,refit.window="moving",
> 	solver = "hybrid", calculate.VaR = TRUE,
> 	VaR.alpha =0.01)
>
> plot(roll,which=4,VaR.alpha=0.01)
>
>
>
> ____________________________________________________________
> South Africas premier free email service - www.webmail.co.za
>
> For super low premiums, click here.
> http://www.dialdirect.co.za/smart-can-get-a-parrot-hands-free-kit?vdn=15752
>
> _______________________________________________
> 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