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




________________________________
From: Peter Ehlers <ehl...@ucalgary.ca>

Cc: r-help@r-project.org
Sent: Mon, February 15, 2010 10:52:33 AM
Subject: Re: [R] rlaplace using rmutil - HELP

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.
(Untested)

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

  -Peter Ehlers

>
>
>
>     [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help@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



      
        [[alternative HTML version deleted]]

______________________________________________
R-help@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.

Reply via email to