[R-SIG-Finance] pointers on using VaR.gpd with return series?
kriskumar at earthlink.net
Wed Aug 22 03:42:40 CEST 2007
Sylvain BARTHELEMY wrote:
> I think that there is a problem with the VaR.gpd function, as it works on
> USD/EUR and not on EUR/USD values
> eurusd <- get.hist.quote("EUR/USD", provider="oanda", start = "2006-01-01")
> usdeur <- get.hist.quote("USD/EUR", provider="oanda", start = "2006-01-01")
> v1 <- VaR.gpd(as.vector(eurusd))
> v2 <- VaR.gpd(as.vector(usdeur))
>> v1 <- VaR.gpd(as.vector(eurusd))
> Error in optim(init, gpd.liklhd, hessian = TRUE, method = "Nelder-Mead") :
> non-finite finite-difference value 
> In addition: There were 50 or more warnings (use warnings() to see the
> first 50)
Ouch the default parameters there are two possible fixes setting the
cut-off threshold using p.tr helps.
(a) doing the following call on your data comes back with some results..
> v1 <- VaR.gpd(as.vector(eurusd),p.tr=0.95)
(b) The other alternate is to rewrite VaR.gpd and set hessian=FALSE
where it makes the call to maximize the log-likelihood.
optim(init, gpd.liklhd, *hessian = TRUE*, method = "Nelder-Mead") :
Neither of these are "the solution" as this is more an Art than a
science. Method (a) relates to the question of how to pick the
threshold. Very few and
you have biased fit and too many you are no longer fitting the tail.
In this context I would point you towards the evir library and the
excellent book by Alex Mcneill on this but doing the following should
give you some hints..
Hope this helps,
More information about the R-SIG-Finance