[R] rlaplace using rmutil - HELP

Peter Ehlers ehlers at ucalgary.ca
Mon Feb 15 16:52:33 CET 2010

On 2010-02-15 8:26, vaibhav dua wrote:
> Hi,
> I'm using rlaplace distribution to draw non normal random deviates. I'm using rmutil package for this. I know rlaplace needs location and dispersion parameters but I want to pass diag matrix as dispersion parameters and I'm not getting the correct values. Here is my code snippet:
>      dispersion = c(3,.20,.10)
>      dispDiag = diag(dispersion)
>      location = c(0,0,0)
>      output = (rlaplace(3, location, dispDiag))
> Here is what I get:
>   -0.8475811  0.0000000  0.0000000
> I dont know why it is returning 0's at 2nd and 3rd place. If I change the values in location vector, it simply picks up the value and replace it at 2nd and 3rd place.
> You help will be highly appreciated
> Victor

If you read the help page carefully, you'll see that rlaplace()
wants a *vector* of dispersion parameters. So why not just use

  rlaplace(3, location, dispersion)

With dispDiag, rlaplace is probably taking 's' to be
c(3,0,0,0,.20,0,0,0,.1) and is only using the first three elements.

In case you're not aware: there's also rlaplace() in the VGAM package.

  -Peter Ehlers

> 	[[alternative HTML version deleted]]
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

Peter Ehlers
University of Calgary

More information about the R-help mailing list