[R-SIG-Finance] RUGARCH --- "pdist" peculiarities wrt. a numerical optimization problem
Johannes Moser
jzmoser at gmail.com
Thu Apr 24 23:35:11 CEST 2014
Dear R-Users and Contributors,
to back out a Value at Risk quantile from a student t mixture distribution need to utilize standardized student t distributions (mean zero, unti variance).
However, there seems to be an issue when working with the pdist-function implemented in the RUGARCH-package (and to my knowledge this is the only implementation of a standardized student t distribution in R).
My problem can easier be demonstrated by means of a standard normal distribution:
###########################################################################
### direct way to the 1% standard normal quantile
qnorm( 0.01 , 0 , 1 )
### indirect way (leads nearly to the same result)
find_quant <- function(quant) {
pdist( distribution = "norm" , quant, mu = 0 , sigma = 1) - 0.01
}
bestquant <- uniroot(f = find_quant, interval = c(-5, 2)); bestquant$root
### this should give the same result, BUT IT DOES NOT ???
find_quant <- function(quant) {
0.5*pdist( distribution = "norm" , quant, mu = 0 , sigma = 1)
+ 0.5*pdist( distribution = "norm" , quant, mu = 0 , sigma = 1) - 0.01
}
bestquant <- uniroot(f = find_quant, interval = c(-5, 2)); bestquant$root
# interestingly, the result changes when modifying the mixing law to e.g. 0.1 and 0.9, respectively.
### using the R-base functions, there seems to be no problem here:
find_quant <- function(quant) {
0.5*pnorm(quant,0,1) + 0.5*pnorm(quant,0,1) - 0.01
}
bestquant <- uniroot(f = find_quant, interval = c(-5, 2)); bestquant$root
# this method gives the correct result and is insensitive to the mixing law.
# however, as mentioned above, I have to do a similar thing using a standardized student t
# distribution which is not implemented in base R.
###########################################################################
Thanks a lot for any ideas or suggestions!!
Best,
Johannes
More information about the R-SIG-Finance
mailing list