data('swissRain')
swissRain = unwrap(swissRain)
swissAltitude = unwrap(swissAltitude)
swissBorder = unwrap(swissBorder)
swissFit = lgm("rain", swissRain, grid=30,
boxcox=0.5,fixBoxcox=TRUE, covariates=swissAltitude)
swissExc = excProb(swissFit, 20)
mycol = c("green","yellow","orange","red")
mybreaks = c(0, 0.2, 0.8, 0.9, 1)
plot(swissBorder)
plot(swissExc, breaks=mybreaks, col=mycol,add=TRUE,legend=FALSE)
plot(swissBorder, add=TRUE)
legend("topleft",legend=mybreaks, col=c(NA,mycol))
# \donttest{
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)
swissRain$sqrtrain = sqrt(swissRain$rain)
swissFit2 = glgm(formula="sqrtrain",data=swissRain, grid=40,
covariates=swissAltitude,family="gaussian")
swissExc = excProb(swissFit2, threshold=sqrt(30))
swissExc = excProb(swissFit2$inla$marginals.random$space, 0,
template=swissFit2$raster)
}
# }
Run the code above in your browser using DataLab