data(Germany) g = system.file("demodata/germany.graph", package="INLA") source(system.file("demodata/Bym-map.R", package="INLA")) ## just make a duplicated column Germany = cbind(Germany,region.struct=Germany$region) # standard BYM model (without covariates) formula1 = Y ~ f(region.struct,model="besag",graph=g) + f(region,model="iid") result1 = inla(formula1,family="poisson",data=Germany,E=E) ## how to access single parameters in INLA # get the names of all hyperparameters names(result1$marginals.hyperpar) # plot the posterior marginal for the first hyperparameter plot(result1$marginals.hyperpar[[1]], type="l") # plot a "more smooth" function of the posterior marginal for # the first hyperparameter plot(inla.smarginal(result1$marginals.hyperpar[[1]]), type="l") # plot the precision parameter on the internal scale, here the log-scale. plot(result1$internal.marginals.hyperpar[[1]], type="l") # show the first 6 summary lines for the random effect "region" head(result1$summary.random$region) # plot a "smooth" posterior martginal density for the fifth # component in "region" plot(inla.smarginal(result1$marginals.random$region[[5]]), type="l")