Examples and tutorials‎ > ‎Volume I‎ > ‎

Code for Munich example

#load the data
data(Munich)
#load the map
g = system.file("demodata/munich.graph", package="INLA")

## Note that here we what to have an estimator of the effect of `year`
## also the for years where we have no observation, therefore we give a
## vector with all possible values assumed by the covariate `year`, that
## is seq(1918,2001)

formula = rent ~ f(location,model="besag",graph.file=g,initial=1,param=c(1,0.01)) +
                      f(year,model="rw2",values=seq(1918,2001),param=c(1,0.01)) +
                      f(floor.size,model="rw2",param=c(1,0.01)) +
                      Gute.Wohnlage + Beste.Wohnlage + Keine.Wwv + Keine.Zh +
                      Kein.Badkach  + Besond.Bad + Gehobene.Kueche +
                      zim1 + zim2 + zim3 + zim4 + zim5 + zim6 -1

mod  =  inla(formula,data=Munich, verbose = TRUE,
                  control.family=list(initial=-1),
                  control.predictor = list(initial = 12),
                  control.inla = list(h=1e-4))
Comments