[RsR] Data generation from Laplace distribution in R
maechler at stat.math.ethz.ch
Mon Nov 17 23:43:05 CET 2008
>>>>> "DK" == khanx131 <khanx131 at umn.edu>
>>>>> on 15 Nov 2008 20:45:52 -0600 writes:
DK> Hi, Everyone, I have problem in data generation using
DK> Laplace distribution. i tried "rlaplace()" in VGAM
DK> package but when i install this package then
DK> predict(lm(...)) and resid(lm(...)) etc does not
DK> work. please let me know if anyone who know how to deal
DK> with it, and generate Laplace data. it would be greatly
DK> appreciated. thanks in advance,
Hmm, yes, I see
Loading required package: splines
Loading required package: stats4
Attaching package: 'VGAM'
The following object(s) are masked from package:splines :
The following object(s) are masked from package:graphics :
The following object(s) are masked from package:stats :
The following object(s) are masked from package:base :
This indeed a pretty startling sign, and I would indeed be
reluctant to use VGAM for the time being, myself.
I got acquainted with Thomas Yee, the VGAM author, and have
known him as a very smart person. But these maskings of
standard R functions are really not a good idea.
[Thomas: We should communicate privately in order to get a
better solution for VGAM]
But for rlaplace(), as Murray has just replied I see,
that is really just an exponential with a random sign.
Thomas' rlaplace() is just a "better" insofar as it nicely computes one
Laplace variate from one uniform.
So you can do something like :
Rlaplace <- rlaplace
rlaplace <- Rlaplace
A slightly more interesting problem is the generalization of
Generate Huber_c distributed variates ...
More information about the R-SIG-Robust