require("geostatsp")
data("swissRain")
swissRain = unwrap(swissRain)
swissAltitude = unwrap(swissAltitude)
swissRain$lograin = log(swissRain$rain)
if(requireNamespace('INLA', quietly=TRUE)) {
INLA::inla.setOption(num.threads=2)
# not all versions of INLA support blas.num.threads
try(INLA::inla.setOption(blas.num.threads=2), silent=TRUE)
swissFit = glgm(formula="lograin", data=swissRain,
grid=20,
covariates=swissAltitude/1000, family="gaussian",
prior = list(sd=1, range=100*1000, sdObs = 2),
control.inla = list(strategy='gaussian', int.strategy='eb'),
control.mode = list(theta=c(1.6542995, 0.7137123,2.2404179))
)
if(length(swissFit$parameters)) {
postExp(swissFit$parameters$summary)
}
}
Run the code above in your browser using DataLab