HyperbolicDistribution        package:fBasics        R Documentation

_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:

     A collection and description of functions to compute density,
     distribution function, quantile function and to generate random
     variates for three cases of the generalized hyperbolic
     distribution: the  generalized hyperbolic distribution itself, the
      hperbolic distribution and the normal inverse Gaussian 
     distribution. 

     The functions are:

       '[dpqr]gh'          The generalized hyperbolic distribution,
       '[dpqr]hyp'         The hyperbolic distribution,
       '[dpqr]nig'         The normal inverse Gaussian distribution,
       'dght'              The Student-t limit density,
       'hypMode'           the hyperbolic mode,
       'nigShapeTriangle'  plots NIG Shape Triangle,
       'hypSlider'         interactive hyperbolic distribution display,
       'nigSlider'         interactive NIG distribution display.

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

     dgh(x, alpha = 1, beta = 0, delta = 1, mu = 0, lambda = 1, log = FALSE)
     pgh(q, alpha = 1, beta = 0, delta = 1, mu = 0, lambda = 1)
     qgh(p, alpha = 1, beta = 0, delta = 1, mu = 0, lambda = 1)
     rgh(n, alpha = 1, beta = 0, delta = 1, mu = 0, lambda = 1)

     dhyp(x, alpha = 1, beta = 0, delta = 1, mu = 0, pm = c(1, 2, 3, 4))
     phyp(q, alpha = 1, beta = 0, delta = 1, mu = 0, pm = c(1, 2, 3, 4), ...)
     qhyp(p, alpha = 1, beta = 0, delta = 1, mu = 0, pm = c(1, 2, 3, 4), ...)
     rhyp(n, alpha = 1, beta = 0, delta = 1, mu = 0, pm = c(1, 2, 3, 4))

     dnig(x, alpha = 1, beta = 0, delta = 1, mu = 0, log = FALSE)
     pnig(q, alpha = 1, beta = 0, delta = 1, mu = 0)
     qnig(p, alpha = 1, beta = 0, delta = 1, mu = 0)
     rnig(n, alpha = 1, beta = 0, delta = 1, mu = 0)

     dght(x, beta = 1e-6, delta = 1, mu = 0, nu = 10, log = FALSE)

     nigShapeTriangle(object, add = FALSE, ...)

     hypMode(alpha = 1, beta = 0, delta = 1, mu = 0, pm = c(1, 2, 3, 4))

     hypSlider()
     nigSlider()

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

     add: [nigShapeTriangle] - 
           a logical value. Should another point added to the NIG shape
          triangle? By default FALSE, a new plot will be created. 

alpha, beta, delta, mu, lambda: shape parameter 'alpha'; skewness
          parameter 'beta', 'abs(beta)' is in the  range (0, alpha);
          scale parameter 'delta', 'delta' must be zero or  positive; 
          location parameter 'mu', by default 0; and lambda parameter
          'lambda', by default 1. These is the meaning of the
          parameters in the first  parameterization 'pm=1' which is the
          default  parameterization selection. In the second
          parameterization, 'pm=2' 'alpha' and 'beta' take the meaning
          of the shape parameters (usually named) 'zeta' and 'rho'. In
          the third parameterization, 'pm=3' 'alpha' and 'beta' take
          the meaning of the shape parameters (usually named) 'xi' and
          'chi'. In the fourth parameterization, 'pm=4' 'alpha' and
          'beta' take the meaning of the shape parameters (usually
          named) 'a.bar' and 'b.bar'. 

     log: a logical flag by default 'FALSE'.  Should the logarithm of
          the density be returned? 

       n: number of observations. 

      nu: a numeric value, the number of degrees of freedom. 

  object: [nigShapeTriangle] - 
           an object of class '"fDISTFIT"' as returned by the function
          'nigFit'. 

       p: a numeric vector of probabilities. 

      pm: an integer value between '1' and '4' for the  selection of
          the parameterization. The default takes the first
          parameterization.        

    x, q: a numeric vector of quantiles. 

     ...: arguments to be passed to the function 'integrate'. 

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

     *Generalized Hyperbolic Distibution:* 

      The generator 'rgh' is based on the GH algorithm given  by Scott
     (2004). 

     *Hyperbolic Distibution:* 

      The generator 'rhyp' is based on the HYP algorithm given  by
     Atkinson (1982). 

     *Normal Inverse Gaussian Distribution:* 

      The random deviates are calculated with the method described by 
     Raible (2000).

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

     All values for the '*gh', '*hyp', and '*nig'  functions are
     numeric vectors:  'd*' returns the density, 'p*' returns the
     distribution function, 'q*' returns the quantile function, and
     'r*' generates random deviates.

     All values have attributes named '"param"' listing the values of
     the distributional parameters.

     The function 'hyp*Mode' returns the mode in the appropriate
     parameterization. A numeric value.

     The functions 'hypSlider' and 'nigSlider'  display for educational
     purposes the densities and probabilities of the hyperbolic and
     normal inverse Gaussian distributions.

_N_o_t_e:

     An undocumented R function for the modified Bessel function  K1
     named '.BesselK1(X)' is availalble, which is called by the S-Plus
     version of the program.

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

     David Scott for the HYP Generator from R's "HyperbolicDist"
     package, 
      Diethelm Wuertz for the Rmetrics R-port.

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

     Atkinson, A.C. (1982);  _The simulation of generalized inverse
     Gaussian and hyperbolic  random variables_, SIAM J. Sci. Stat.
     Comput. 3, 502-515. 

     Barndorff-Nielsen O. (1977); _Exponentially decreasing
     distributions for the logarithm of  particle size_,  Proc. Roy.
     Soc. Lond., A353, 401-419. 

     Barndorff-Nielsen O., Blaesild, P. (1983);  _Hyperbolic
     distributions. In Encyclopedia of Statistical  Sciences_,  Eds.,
     Johnson N.L., Kotz S. and Read C.B.,  Vol. 3, pp. 700-707. New
     York: Wiley. 

     Raible S. (2000); _Levy Processes in Finance: Theory, Numerics and
     Empirical Facts_, PhD Thesis, University of Freiburg, Germany, 161
     pages.

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

        
     ## nig -
        set.seed(1953)
        r = rnig(5000, alpha = 1, beta = 0.3, delta = 1)
        plot(r, type = "l", col = "steelblue",
          main = "nig: alpha=1 beta=0.3 delta=1")
      
     ## nig - 
        # Plot empirical density and compare with true density:
        hist(r, n = 25, probability = TRUE, border = "white", col = "steelblue")
        x = seq(-5, 5, 0.25)
        lines(x, dnig(x, alpha = 1, beta = 0.3, delta = 1))
      
     ## nig -  
        # Plot df and compare with true df:
        plot(sort(r), (1:5000/5000), main = "Probability", col = "steelblue")
        lines(x, pnig(x, alpha = 1, beta = 0.3, delta = 1))
        
     ## nig -
        # Compute Quantiles:
        qnig(pnig(seq(-5, 5, 1), alpha = 1, beta = 0.3, delta = 1), 
          alpha = 1, beta = 0.3, delta = 1) 

