ghyp-distribution            package:ghyp            R Documentation

_T_h_e _G_e_n_e_r_a_l_i_z_e_d _H_y_p_e_r_b_o_l_i_c _D_i_s_t_r_i_b_u_t_i_o_n

_D_e_s_c_r_i_p_t_i_o_n:

     Density, distribution function, quantile function, expected
     shortfall and random generation for the univariate and
     multivariate generalized hyperbolic distribution and its special
     cases.

_U_s_a_g_e:

     dghyp(x, object = ghyp(), logvalue = F)

     pghyp(q, object = ghyp(), n.sim = 10000, subdivisions = 200, 
           rel.tol = .Machine$double.eps^0.5, abs.tol = rel.tol)

     qghyp(p, object = ghyp(), method = c("integration", "splines"), 
           spline.points = 200, subdivisions = 200, 
           root.tol = .Machine$double.eps^0.5, 
           rel.tol = root.tol^1.5, abs.tol = rel.tol)

     rghyp(n, object = ghyp())

     ESghyp(p, object = ghyp(), ...)

_A_r_g_u_m_e_n_t_s:

       p: A vector of probabilities.

       x: A vector, matrix or data.frame of quantiles.

       q: A vector, matrix or data.frame of quantiles.

       n: Number of observations.

  object: An object inheriting from class 'ghyp'.

logvalue: If 'TRUE' the logarithm of the density will be returned.

   n.sim: The number of simulations when computing 'pghyp' of a
          multivariate generalized hyperbolic distribution.

subdivisions: The number of subdivisions passed to 'integrate' when
          computing the distribution function 'pghyp' of a  univariate
          generalized hyperbolic distribution.

 rel.tol: The relative accuracy requested from  'integrate'.

 abs.tol: The absolute accuracy requested from  'integrate'.

  method: The method how quantiles are computed (see *Details*) .

spline.points: The number of support points when computing the
          quantiles with the method "splines" instead of "integration".

root.tol: The tolerance of 'uniroot'.

     ...: Arguments passed from 'ESghyp' to 'qghyp'.

_D_e_t_a_i_l_s:

     'qghyp' and 'ESghyp' only work for univariate generalized
     hyperbolic distributions. 

     'pghyp' just integrates the density in the univariate case. The
     multivariate  cumulative distribution is computed by means of
     monte carlo simulation. 

     'qghyp' computes the quantiles either by using the "integration"
     method where the root of  the distribution function is solved or
     via "splines" which interpolates the distribution function and
     solves it with 'uniroot' afterwards. The "integration" method is
     recommended when only few quantiles are required. If more than
     approximately 20 quantiles are needed to be calculated the
     "splines" method becomes faster. The accuracy can be controlled
     with an adequate setting of the parameters 'rel.tol', 'abs.tol',
     'root.tol' and 'spline.points'.

     'rghyp' uses the random generator for generalized inverse gaussian
     distributed random variates from the S-Plus library _QRMlib_  (see
     <URL: http://www.math.ethz.ch/~mcneil/book/QRMlib.html>).

_V_a_l_u_e:

     'dghyp' gives the density, 
      'pghyp' gives the distribution function, 
      'qghyp' gives the quantile function, 
      'ESghyp' gives the expected shortfall and  
      'rghyp' generates random deviates.

_N_o_t_e:

     Objects generated with 'hyp', 'NIG', 'VG'  and 'student.t' have to
     use 'Xghyp' as well. E.g. 'dNIG(0, NIG())' does not work but
     'dghyp(0, NIG())'.

     When the skewness becomes very large the functions using 'qghyp'
     may fail.  The functions 'ESghyp', 'qqghyp', 'pairs'  and
     'portfolio.optimize' are based on 'qghyp'.

_A_u_t_h_o_r(_s):

     David Lthi

_R_e_f_e_r_e_n_c_e_s:

     _Quantitative Risk Management: Concepts, Techniques and Tools_ by
     Alexander J. McNeil, Rdiger Frey and Paul Embrechts 
      Princeton Press, 2005 

_S_e_e _A_l_s_o:

     'ghyp-class' definition, 'ghyp' constructors,  fitting routines
     'fit.ghypuv' and 'fit.ghypmv',  'integrate', 'spline'.

_E_x_a_m_p_l_e_s:

       ## Univariate generalized hyperbolic distribution
       univariate.ghyp <- ghyp()
       
       par(mfrow=c(5, 1))
       
       quantiles <- seq(-4, 4, length = 500)
       plot(quantiles, dghyp(quantiles, univariate.ghyp))
       plot(quantiles, pghyp(quantiles, univariate.ghyp))
       
       probabilities <- seq(1e-4, 1-1e-4, length = 500)
       plot(probabilities, qghyp(probabilities, univariate.ghyp, method = "splines"))
       plot(probabilities, ESghyp(probabilities, univariate.ghyp, method = "splines"))
       
       hist(rghyp(n=10000,univariate.ghyp),nclass=100)
       
       ## Mutivariate generalized hyperbolic distribution
       multivariate.ghyp <- ghyp(sigma=var(matrix(rnorm(10),ncol=2)),mu=1:2,gamma=-(2:1))
       
       par(mfrow=c(2, 1))
       
       quantiles <- outer(seq(-4, 4, length = 50), c(1, 1))
       plot(quantiles[, 1], dghyp(quantiles, multivariate.ghyp))
       plot(quantiles[, 1], pghyp(quantiles, multivariate.ghyp, n.sim = 1000))
       
       rghyp(n = 10, multivariate.ghyp)

