# NOT RUN {
library(INLA)
data(Epil)
##Define the model
formula = y ~ Trt + Age + V4 +
f(Ind, model="iid") + f(rand,model="iid")
result = inla(formula, family="poisson", data = Epil, control.predictor = list(compute = TRUE))
plot(result)
p <- autoplot(result)
# Change the theme
p <- p + theme_bw()
# Add a title to a subplot
p[2] <- p[2] + ggtitle('Hyper parameters')
# Switch plot of fixed effects posteriors to not rescale x axis
# If variables are on the same scale, this may provide a useful comparison
p[1] <- p[1] + facet_wrap('var', scale = 'free_y')
# Change colours etc.
p[[1]]$layers[[1]] <- geom_line(colour = 'red', linetype = 2)
# }
Run the code above in your browser using DataLab