sgh                 package:fBasics                 R Documentation

_S_t_a_n_d_a_r_d_i_z_e_d _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  and random
     generation for the standardized generalized hyperbolic
     distribution.

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

     dsgh(x, zeta = 1, rho = 0, lambda = 1, log = FALSE)
     psgh(q, zeta = 1, rho = 0, lambda = 1)
     qsgh(p, zeta = 1, rho = 0, lambda = 1)
     rsgh(n, zeta = 1, rho = 0, lambda = 1)

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

zeta, rho, lambda: shape parameter 'zeta' is positive, skewness
          parameter 'rho' is in the range (-1, 1). 

     log: a logical flag by default 'FALSE'.  If TRUE, log values are
          returned. 

       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 generator 'rsgh' is based on the GH algorithm given  by Scott
     (2004).

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

     All values for the '*sgh' 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):

     Diethelm Wuertz.

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

        
     ## rsgh -
        set.seed(1953)
        r = rsgh(5000, zeta = 1, rho = 0.5, lambda = 1)
        plot(r, type = "l", col = "steelblue",
          main = "gh: zeta=1 rho=0.5 lambda=1")
      
     ## dsgh - 
        # Plot empirical density and compare with true density:
        hist(r, n = 50, probability = TRUE, border = "white", col = "steelblue",
          ylim = c(0, 0.6))
        x = seq(-5, 5, length = 501)
        lines(x, dsgh(x, zeta = 1, rho = 0.5, lambda = 1))
      
     ## psgh -  
        # Plot df and compare with true df:
        plot(sort(r), (1:5000/5000), main = "Probability", col = "steelblue")
        lines(x, psgh(x, zeta = 1, rho = 0.5, lambda = 1))
        
     ## qsgh -
        # Compute Quantiles:
        round(qsgh(psgh(seq(-5, 5, 1), zeta = 1, rho = 0.5), zeta = 1, rho = 0.5), 4)

