contributed-1: Computes the standard deviation for the structured (random)...

Description Usage Arguments Value Author(s) See Also Examples

Description

Computes the posterior distribution of the standard deviations for the structured (random) effects in an INLA model, starting from the default output based on the precisions

Usage

1
    inla.contrib.sd(model, nsamples=1000)

Arguments

model

An INLA model, fitted calling the inla()-function. The formula specified for the model should include at least one structured (random) effect in the form f(variable, model="iid").

nsamples

The number of simulations from the posterior distribution of the standard deviations used to compute the summary statistics

Value

inla.contrib.sd returns a matrix samples including the simulated values from the posterior distributions as well as a summary table hyper reporting the mean, sd and 95% credible interval for the posterior distributions of each random effect.

Author(s)

Gianluca Baio gianluca@stats.ucl.ac.uk

See Also

inla

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
# Data generation
n=12
Ntrials = sample(c(80:100), size=n, replace=TRUE)
eta = rnorm(n,0,0.5)
prob = exp(eta)/(1 + exp(eta))
y = rbinom(n, size=Ntrials, prob = prob)
data=data.frame(y=y,z=1:n)
formula=y~f(z,model="iid")
m=inla(formula,data=data,family="binomial",Ntrials=Ntrials)
summary(m)
s=inla.contrib.sd(m)
s$hyper
hist(s$samples,xlab="standard deviation for z",main="")

inbo/INLA documentation built on Dec. 6, 2019, 9:51 a.m.