library("INLA")
set.seed(2019)
beta0=-2
beta1=2
beta2=10
sigma2=5
tau=1/sigma2
n=200
x=rnorm(n,0,1)
e=rnorm(n,0, sd = sqrt(sigma2))  
y=beta0+beta1*x+e
dado=as.data.frame(cbind(y,x))
modelo= inla(y~x,family="gaussian",data=dado,control.compute=list(config=TRUE))
summary(modelo)

Call:
"inla(formula = y ~ x, family = \"gaussian\", data = dado, control.compute = list(config = TRUE))"

Time used:
 Pre-processing    Running inla Post-processing           Total 
         0.6854          0.2491          0.0568          0.9913 

Fixed effects:
               mean     sd 0.025quant 0.5quant 0.975quant    mode kld
(Intercept) -2.2071 0.1563    -2.5143  -2.2071    -1.9001 -2.2071   0
x            1.9417 0.1641     1.6191   1.9417     2.2640  1.9417   0

The model has no random effects

Model hyperparameters:

Expected number of effective parameters(std dev): 2.00(0.00)
Number of equivalent replicates : 99.99 

Marginal log-Likelihood:  -458.93 
b0 = modelo$marginals.fixed$`(Intercept)`[,1]
b1 = modelo$marginals.fixed$x[,1]
tau = modelo$marginals.hyperpar$`Precision for the Gaussian observations`[,1]
plot(density(b0))

plot(density(b1))

plot(density(tau))

inla.hpdmarginal(p = .95, modelo$marginals.fixed$`(Intercept)`)
                 low      high
level:0.95 -2.514264 -1.901067
inla.hpdmarginal(p = .95, modelo$marginals.fixed$x)
                low     high
level:0.95 1.619101 2.262927
inla.hpdmarginal(p = .95, modelo$marginals.hyperpar$`Precision for the Gaussian observations`)
                 low      high
level:0.95 0.1694985 0.2515103
b0  = inla.tmarginal(function(x)x,modelo$marginals.fixed$`(Intercept)`)
b1  = inla.tmarginal(function(x)x,modelo$marginals.fixed$x)
tau = inla.tmarginal(function(x)x,modelo$marginals.hyperpar$`Precision for the Gaussian observations`)
plot(b0, type="l")

plot(b1, type="l")

plot(tau, type="l")

LS0tDQp0aXRsZTogIlIgTm90ZWJvb2siDQpvdXRwdXQ6IGh0bWxfbm90ZWJvb2sNCi0tLQ0KDQoNCmBgYHtyfQ0KbGlicmFyeSgiSU5M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