Open alashworth opened 5 years ago
Comment by bob-carpenter
Monday May 22, 2017 at 16:22 GMT
Thanks for the issue with definition. This should be relatively easy. You can, of course, just code it in Stan now as
real skew_double_exponential_lpdf(real y, real mu, real sigma, real tau) {
return log(tau) + log1m(tau)
- log(sigma)
- 2 * ((y < mu) ? (1 - tau) * (mu - y) : tau * (y - mu)) / sigma;
}
It's not vectorized and doesn't drop constants (if tau is constant you can drop the first two terms and if sigma is constant you can drop the third, but it should work.
And fair warning: this distribution may cause problems in the region around y == mu
because the derivative's not continuous there.
Comment by bgoodri
Monday May 22, 2017 at 18:26 GMT
It is fairly straightforward to do quantile regression when the asymmetric Laplace distribution is represented as a scale mixture of normals, which is differentiable everywhere. But due to the discontinuity, I don't think it is a big priority to add the _lpdf, etc. to Stan Math and the Stan language.
On Mon, May 22, 2017 at 12:22 PM, Bob Carpenter notifications@github.com wrote:
Thanks for the issue with definition. This should be relatively easy. You can, of course, just code it in Stan now as
real skew_double_exponential_lpdf(real y, real mu, real sigma, real tau) { return log(tau) + log1m(tau)
- log(sigma)
- 2 ((y < mu) ? (1 - tau) (mu - y) : tau * (y - mu)) / sigma; }
It's not vectorized and doesn't drop constants (if tau is constant you can drop the first two terms and if sigma is constant you can drop the third, but it should work.
And fair warning: this distribution may cause problems in the region around y == mu because the derivative's not continuous there.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/stan-dev/stan/issues/2312#issuecomment-303149606, or mute the thread https://github.com/notifications/unsubscribe-auth/ADOrqhQdA1ZqwsnQrHYRwsRmXtLTbqAIks5r8bZHgaJpZM4NhzRp .
Summary:
We would like to have asymmetric Laplace distribution to be implemented in stan.
Description:
As discussed in the mailing list, it is particularly of interest for Bayesian quantile regression.
Also known as skewed Laplace distribution, the asymmetric Laplace distribution has an additional parameter
\tau (\tau \in [0,1])
which reduces to Laplace distribution when
\tau=0.5
.With the Laplace distribution already in stan (named DoubleExponential), introducing asymmetric Laplace distribution is relatively straight forward.
Additional Information:
Yu, K., Moyeed, R.A., 2001. Bayesian quantile regression. Statistics & Probability Letters 54, 437–447. doi:10.1016/S0167-7152(01)00124-9