nig                 package:fBasics                 R Documentation

_N_o_r_m_a_l _I_n_v_e_r_s_e _G_a_u_s_s_i_a_n _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  and random
     generation for the normal inverse Gaussian distribution.

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

     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)

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

alpha, beta, delta, mu: 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. These are the
          parameters in the first parameterization. 

     log: a logical flag by default 'FALSE'.  Should labels and a main
          title drawn to the plot? 

       n: number of observations. 

       p: a numeric vector of probabilities. 

    x, q: a numeric vector of quantiles. 

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

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

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

     All values for the '*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.

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

     David Scott for code implemented from R's  contributed package
     'HyperbolicDist'.

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

