(Mis)understanding reparameterization of the double-exponential distribution

Hi Josh,
mu and sigma are the model parameters and are fixed (for simulation purposes). For example define mu = 1 and sigma = 1. Simulate using the double_exponential_rng function.

Then compare that to the alternative way to generate the follow the steps in the link that you shared (i.e. simulate from a normal and simulate alpha from an exponential distribution).
@Bob_Carpenter: I think that there is a typo in the manual at 19.7 Double exponential (Laplace) distribution | Stan Functions Reference (mc-stan.org). We require the square root of alpha (I checked this by simulation in R).

Beta = mu + sqrt(alpha)*Beta_raw

sigma <- 1
mu <- 10
n_sim <- 1000000
alpha <- rexp(n_sim, 1/(2*(sigma^2)))
beta <- mapply(rnorm, n = 1,mean = mu, sd  = sqrt(alpha))
dens1 <- density(beta)

beta_raw <- rnorm(n_sim)
plot(density(mu +(sqrt(alpha)*beta_raw)), col = "red")
lines(dens1$x, dens1$y)

1 Like