laplaceUC                package:VGAM                R Documentation

_T_h_e _L_a_p_l_a_c_e _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 Laplace distribution with location parameter
     'location' and scale parameter 'scale'.

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

     dlaplace(x, location=0, scale=1)
     plaplace(q, location=0, scale=1)
     qlaplace(p, location=0, scale=1)
     rlaplace(n, location=0, scale=1)

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

    x, q: vector of quantiles.

       p: vector of probabilities.

       n: number of observations. Positive integer of length 1.

location: the location parameter mu, which is the mean. 

   scale: the scale parameter b. Must consist of positive values. 

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

     The Laplace distribution is often known as the double-exponential
     distribution and, for modelling, has heavier tail than the normal
     distribution. The Laplace density function is 

                  f(y) =  (1/(2b)) exp( -|y-mu|/b )

     where -Inf<y<Inf, -Inf<mu<Inf and b>0. The mean is mu and the
     variance is 2b^2.

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

     'dlaplace' gives the density, 'plaplace' gives the distribution
     function, 'qlaplace' gives the quantile function, and 'rlaplace'
     generates random deviates.

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

     T. W. Yee

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

     Evans, M., Hastings, N. and Peacock, B. (2000) _Statistical
     Distributions_, New York: Wiley-Interscience, Third edition.

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

     loc = 1; b = 2
     y = rlaplace(n=100, loc=loc, scale=b)
     mean(y)
     loc      # population mean
     var(y)
     2 * b^2  # population variance

     ## Not run: 
     x = seq(-5, 5, by=0.01)
     loc = 0; b = 1.5
     plot(x, dlaplace(x, loc, b), type="l", col="blue", ylim=c(0,1),
          main="Blue is density, red is cumulative distribution function",
          sub="Purple are 5,10,...,95 percentiles", las=1, ylab="")
     abline(h=0, col="blue", lty=2)
     lines(qlaplace(seq(0.05,0.95,by=0.05), loc, b),
           dlaplace(qlaplace(seq(0.05,0.95,by=0.05), loc, b), loc, b),
           col="purple", lty=3, type="h")
     lines(x, plaplace(x, loc, b), type="l", col="red")
     abline(h=0, lty=2)
     ## End(Not run)

     plaplace(qlaplace(seq(0.05,0.95,by=0.05), loc, b), loc, b)

