Random number generation from the multivariate Laplace distribution.
Usage
rmLaplace(n = 1, center = rep(0, nrow(Scatter)), Scatter = diag(length(center)))
Arguments
n
the number of samples requested
center
a vector giving the locations of each variable
Scatter
a positive-definite dispersion matrix
Details
The function rmLaplace is an interface to C routines, which make calls to
subroutines from LAPACK. The matrix decomposition is internally done using
the Cholesky decomposition. If Scatter is not non-negative definite then
there will be a warning message.
Value
If n = 1 a vector of the same length as center, otherwise a
matrix of n rows of random vectors.
References
Gomez, E., Gomez-Villegas, M.A., and Marin, J.M. (1998).
A multivariate generalization of the power exponential family of distributions.
Communications in Statistics - Theory and Methods27, 589-600.
Kotz, S., Kozubowski, T.J., and Podgorski, K. (2001).
The Laplace Distributions and Generalizations.
Birkhauser, Boston.
Examples
# dispersion parameters
Scatter <- matrix(c(1,.5,.5,1), ncol = 2)
Scatter
# generate the sample
y <- rmLaplace(n = 2000, Scatter = Scatter)
# scatterplot of a random bivariate Laplace sample with center
# vector zero and scale matrix 'Scatter'
par(pty = "s")
plot(y, xlab = "", ylab = "")
title("bivariate Laplace sample", font.main = 1)
Results
R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> library(L1pack)
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/L1pack/rmLaplace.Rd_%03d_medium.png", width=480, height=480)
> ### Name: rmLaplace
> ### Title: Multivariate Laplace Random Deviates
> ### Aliases: rmLaplace
> ### Keywords: distribution multivariate
>
> ### ** Examples
>
> # dispersion parameters
> Scatter <- matrix(c(1,.5,.5,1), ncol = 2)
> Scatter
[,1] [,2]
[1,] 1.0 0.5
[2,] 0.5 1.0
>
> # generate the sample
> y <- rmLaplace(n = 2000, Scatter = Scatter)
>
> # scatterplot of a random bivariate Laplace sample with center
> # vector zero and scale matrix 'Scatter'
> par(pty = "s")
> plot(y, xlab = "", ylab = "")
> title("bivariate Laplace sample", font.main = 1)
>
>
>
>
>
> dev.off()
null device
1
>