[R-SIG-Finance] (no subject)

Wei-han Liu weihanliu2002 at yahoo.com
Tue May 13 05:07:29 CEST 2014


Dear R users:

I have encountered a problem on R package GeneralizedHyperbolic. It fails to integrate for the lower tail area but I do not know how to solve it. Listed below are my coding and the error message:

require(GeneralizedHyperbolic)
return = read.csv("d://UK.R.csv",blank.lines.skip=TRUE,stringsAsFactors=FALSE)
# return <- apply(series, function(x) diff(log(x)))
UK= as.numeric(return[,2])

UK.R=diff(log(na.omit(UK)))

period=50 # moving-window length
n=length(UK.R)
VaR05.UK.qghyp <- numeric(n-period)
for (p in 1:(n-period))
{
  temp = UK.R[p:(period+p)]
   probabilities6 <- 0.05
  VaR0001.UK.qghyp[p]<- qhyperb(probabilities6,param =c(hyperbFit(temp)[1]$param[1],hyperbFit(temp)[1]$param[2],hyperbFit(temp)[1]$param[3],hyperbFit(temp)[1]$param[4]),lower.tail = TRUE, method = c("spline"),subdivisions = 50)

 } 

ERROR message: Error in integrate(dghypInt, q[i], Inf, subdivisions = subdivisions, rel.tol = intTol,  : 
  the integral is probably divergent

If I change the method to integrate, it shows the error message below:
Error in uniroot(zeroFun, interval = c(mode, xHigh), ...) : 
  f() values at end points not of opposite sign
In addition: Warning messages:
1: In optimize(f = modeFun, interval = range, maximum = TRUE) :
  NA/Inf replaced by maximum positive value
2: In optimize(f = modeFun, interval = range, maximum = TRUE) :
  NA/Inf replaced by maximum positive value
3: In optimize(f = modeFun, interval = range, maximum = TRUE) :
  NA/Inf replaced by maximum positive value
4: In optimize(f = modeFun, interval = range, maximum = TRUE) :
  NA/Inf replaced by maximum positive value
5: In optimize(f = modeFun, interval = range, maximum = TRUE) :
  NA/Inf replaced by maximum positive value
6: In optimize(f = modeFun, interval = range, maximum = TRUE) :
  NA/Inf replaced by maximum positive value

Does any people can help solve this problem?

Best regards,

Weihan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://stat.ethz.ch/pipermail/r-sig-finance/attachments/20140512/975cdae6/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: UK.R.csv
Type: application/vnd.ms-excel
Size: 196752 bytes
Desc: not available
URL: <https://stat.ethz.ch/pipermail/r-sig-finance/attachments/20140512/975cdae6/attachment.xlb>


More information about the R-SIG-Finance mailing list