In this example we infer the parameters of one-variable Bayesian linear regression model using an exponential-normal prior. A compound exponential-normal prior can be interpreted like an equivalent to the frequentist LASSO. The exponential-normal prior yields a posterior that is pooled towards zero. An exponential-normal prior, or equivalently a Laplace prior, is consequently often chosen when a sparse solution is assumed, which, for instance, is a natural scenario in many biological settings.
# variables & priors int <- variable() sd <- inverse_gamma(1, 1) lambda <- gamma(1, 1) tau <- exponential(0.5 * lambda**2) coef <- normal(0, tau) # linear predictor mu <- int + coef * attitude$complaints # observation model distribution(attitude$rating) <- normal(mu, sd)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.