Skip to contents

Convert the posterior marginal of a precision to a standard deviation

Usage

prec2sd(marg)

Arguments

marg

A matrix with columns "y" and "x" where "y" is the marginal of the precision.

Value

A data.frame with the mean, standard deviation and 2.5%, 25%, 50%, 75% and 97.5% quantiles of the posterior of the standard deviation.

Examples

stopifnot(require(INLA))
model <- inla(Sepal.Length ~ Species, data = iris, family = "gaussian")
marg <- model$marginals.hyperpar[["Precision for the Gaussian observations"]]
prec2sd(marg)
#>        mean         sd quant0.025 quant0.25  quant0.5 quant0.75 quant0.975
#> 1 0.5138908 0.02977802  0.4594277 0.4930231 0.5124215 0.5331242  0.5763636