Dear friends,

Please find below the code that I have employed for a rejection sampler to draw from asymmetric laplace distributions. I was wondering if this code can be written more efficiently? Are there more efficient ways of drawing random numbers from asymmetric laplace distributions??

Thanks in advance for your help and have a great weekend.

Regards

Anup

***********************************
ral <- function(n,p,s=3)
{
rout <- matrix(0,n)
for(i in 1:n)
{
  repeat
    {
      root <- rnorm(1)
      ratio <- dal(val=root, p=p)/(s*dnorm(root))
      alpha <- runif(1, min=0, max=1)
      if(alpha<ratio)
        {break}
      }
   rout[i,] <- root
}
return(rout)}


       
---------------------------------

	[[alternative HTML version deleted]]

