Code for Laplace prior

367 views
Skip to first unread message

Patrik Waldmann

unread,
Jul 17, 2012, 8:41:14 AM7/17/12
to r-inla-disc...@googlegroups.com
Hello,
 
I understand that it is possible to define own priors and wonder if someone has R code for a Laplace (double exponential) prior?
 
Best,
 
Patrik Waldmann

Daniel Simpson

unread,
Jul 17, 2012, 8:48:17 AM7/17/12
to Patrik Waldmann, r-inla-disc...@googlegroups.com
Hi Patrik,
The example here is fairly straightforward to modify
http://www.math.ntnu.no/inla/r-inla.org/doc/prior/expression.pdf

I'm not 100% sure that it will work - priors are assumed to be twice
differentiable in order to compute the laplace approximation, and the
Laplace prior is not differentiable at zero (which, i guess, is the
point).

Best,
Dan

Patrik Waldmann

unread,
Jul 17, 2012, 10:31:16 AM7/17/12
to r-inla-disc...@googlegroups.com, Patrik Waldmann
What about the scale mixtures of normals with exponential mixing density approach used by Park and Casella (2008) in their Bayesian Lasso paper? Would that be better?
 
Patrik

Patrik Waldmann

unread,
Jul 17, 2012, 11:22:12 AM7/17/12
to r-inla-disc...@googlegroups.com, Patrik Waldmann
The following works, but I wonder if the log(dens) is correct? And how do I assign a hyperprior to b?
laplace = "expression:
mean = 0;
b = 1;
dens = 1/(2*b) *  exp(-abs(x-mean)/b);
logdens = log(dens);
return(logdens)"
 
Patrik
 

Den tisdagen den 17:e juli 2012 kl. 14:48:17 UTC+2 skrev Daniel Simpson:

Daniel Simpson

unread,
Jul 17, 2012, 11:34:03 AM7/17/12
to Patrik Waldmann, r-inla-disc...@googlegroups.com
The prior specification is correct, but it will not do what you want.

I am assuming that you wish to fit the Bayesian Lasso model

y|beta,sigma ~ X*beta + eps
beta_j|sigma ~ Laplace( beta_j; mean=0, scale=sigma^2)

This cannot be fitted in INLA because the beta's are not Gaussian.

To do this in INLA, you need to use the Hierarchical model specification


Assume that there are p beta's. Then

y|beta,sigma ~ N(X*beta, sigma^2 *I)
beta|sigma, tau_1,..., tau_p ~ N(0_p, sigma^2 * D_p)
where D_p = diag(tau_1^2, ..., tau_p^2)
p(tau_j) = lambda^2/2*exp(-lambda^2*tau_j^2/2

So the prior that you need to set is just normally distributed with
variance lambda. You cannot put a prior on lambda within the INLA
framework.

As said in a previous email, you cannot have p > 10 (15 at the
absolute maximum).

I hope this helps,

Dan
Reply all
Reply to author
Forward
0 new messages