This links back to previous posts here and here. Earlier today, I had a quick chat with Michela (by email, actually) on this topic. In particular, she was trying to use the function I’ve written to compute summaries from the posterior distribution of the standard deviation (rather than the precision, given by INLA by default) on an SPDE (Stochastic Partial Differential Equations $-$ some description here) model.

As it turns out, together with the precision for the structured effects, in such a model the element $marginals.hyperpar contains also two other terms, which are specific to SPDE and, more importantly, can also be negative (or are always negative? I’m not quite sure about this). Thus, if you try to apply the function inla.contrib.sd to an SPDE model it basically starts yelling at you for asking to compute a square root of a negative number.

I have to say I’m no expert on SPDE (Marta, Michela and I discuss it too in our soon-to-come-out review paper on INLA, but Michela took care of this part); in fact, I hadn’t even thought about it when writing the function, which I did to deal with my own more or less standard hierarchical model. However, I’ll try to fix this and may be make inla.contrib.sd more general.

*Related*

To

**leave a comment** for the author, please follow the link and comment on his blog:

** Gianluca Baio's blog**.

R-bloggers.com offers

**daily e-mail updates** about

R news and

tutorials on topics such as: visualization (

ggplot2,

Boxplots,

maps,

animation), programming (

RStudio,

Sweave,

LaTeX,

SQL,

Eclipse,

git,

hadoop,

Web Scraping) statistics (

regression,

PCA,

time series,

trading) and more...

If you got this far, why not

__subscribe for updates__ from the site? Choose your flavor:

e-mail,

twitter,

RSS, or

facebook...