[R] rlaplace using rmutil - HELP
ehlers at ucalgary.ca
Mon Feb 15 16:52:33 CET 2010
On 2010-02-15 8:26, vaibhav dua wrote:
> 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
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.
> [[alternative HTML version deleted]]
> R-help at r-project.org mailing list
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
University of Calgary
More information about the R-help