[R] rlaplace using rmutil - HELP

Peter Ehlers ehlers at ucalgary.ca
Mon Feb 15 19:26:33 CET 2010


On 2010-02-15 9:38, vaibhav dua wrote:
> Hi Peter,
>
> Thanks for quick reply. Like I said that I'm aware that it needs a vector but I want to use diagonal matrix.
>
> As you have noted, It could be possible that rlaplace reading dispDiag as a vector and not matrix like c(3,0,0,0,.20,0,0,0,.1) so I thought to change the code little bit:
>
>
> dispersion = c(3,.20,.10)
> dispDiag = diag(dispersion)
> location = c(0,0,0)
> output = (rlaplace(3, location, as.matrix(dispDiag)))
>
> but still get the same output.
>
> I want to draw random deviates from multivariate laplace distribution. Do you think rlaplace in VGAM can help?
>
> Victor
>

You can't just wish away the requirement that 's' be a vector
by telling rlaplace that you're giving it a matrix. It knows
anyway; your as.matrix() won't do anything since dispDiag is
already a matrix.

More importantly: As far as I can see, neither rmutil nor VGAM
provide functions for a *multivariate* Laplace distribution.
I don't know of any package that does - so you'll have to code
your own, I suppose.

Here's a reference:

S Kotz, T Kozubowski, K Podgorski
The Laplace Distribution and Generalizations (Birkhauser 2001)

This link might be of some use:

http://sci.tech-archive.net/Archive/sci.stat.math/2005-07/msg00229.html

  -Peter Ehlers



More information about the R-help mailing list