dlaplace: The Laplace distribution

Description Usage Arguments Details Value Author(s) Examples

View source: R/external.R

Description

Density, cumulative distribution function, quantile function and random generation for the laplace distribution.

Usage

1
2
3
4
dlaplace(x, mu, b, log = FALSE)
plaplace(q, mu, b, lower.tail = TRUE, log.p = FALSE)
qlaplace(p, mu, b, lower.tail = TRUE, log.p = FALSE)
rlaplace(n, mu, b)

Arguments

x,q

(numeric, vector) a vector of quantiles.

p

(numeric, vector) a vector of probablities.

n

(numeric, vector) sample size to be generated.

mu

(numeric, single value) the location parameter.

b

(numeric, single value) the scale parameter.

log, log.p

(logical, single value) if TRUE, probabilities are given as \log(p). Default is FALSE.

lower.tail

(logical, single value) if TRUE (default), probabilities are P(X≤ x); otherwise P(X>x).

Details

The laplace distribution with shape parameter μ>0 and scale parameter b>0 has density

f(x) = \frac{1}{2b}\exp(-\frac{|x-μ|}{b}), \quad x \in R.

Value

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

The length of the result is determined by n for rnorm, and is the maximum of the lengths of the numerical arguments for the other functions.

Author(s)

J. Lequesne justine.lequesne@unicaen.fr

Examples

1
2
set.seed(1)
rlaplace(100,mu=2,b=1)

Example output

Loading required package: fitdistrplus
Loading required package: MASS
Loading required package: survival
  [1]  1.36703937  1.70461876  2.15748073  3.69508066  1.09208376  3.59346304
  [7]  4.20138807  2.38801169  2.29871348 -0.09092692  1.11314464  0.95903427
 [13]  2.46847790  1.73630452  2.77583955  1.99538786  2.57134913  6.12349677
 [19]  1.72565573  2.80943483  4.03569617  1.14265022  2.36146860  0.61813658
 [25]  1.37346669  1.74152480 -1.62007506  1.73182759  3.34469836  1.61536345
 [31]  1.96350222  2.22205870  1.98699846  1.01230779  3.06347675  2.41087996
 [37]  2.88789698  0.46700101  2.59316048  1.80465261  3.02692230  2.34831058
 [43]  2.83440094  2.11213074  2.06127894  2.86443969 -1.06481648  1.95339059
 [49]  2.62479247  2.48688632  1.95420655  3.28164233  1.86783249  1.28582233
 [55]  0.04354107  0.38520939  1.54199358  2.03798075  2.39157722  1.79378777
 [61]  3.74727484  1.46762169  1.91458530  1.59171494  2.35916509  1.33841653
 [67]  1.95614267  2.76061552  0.21914385  3.38886831  1.61160714  3.13594257
 [73]  1.63380413  1.59585881  1.95154739  3.53431500  3.30445244  1.75151183
 [79]  2.80887547  4.54129917  1.85995483  2.55343630  1.77684237  1.57030004
 [85]  2.72190535  1.09708075  2.54860095  0.58688452  1.28864206  0.75036280
 [91]  1.26448553 -0.13818352  2.33488063  3.39649996  2.81605940  2.90292459
 [97]  1.90629233  1.80175412  2.97217477  2.23555346

vsgoftest documentation built on Dec. 17, 2020, 5:06 p.m.