1 Installing INLA

1.1 Installation

install.packages("INLA", repos=c(getOption("repos"), 
        INLA="https://inla.r-inla-download.org/R/testing"), dep=TRUE)

If you have INLA installed, you should update it to the latest version:

library(INLA)
inla.update(testing=T)

1.2 Check that it works

Run the following simple code

library(INLA)
inla(formula=y~1,data=list(y=1:9))
## Call:
##    c("inla.core(formula = formula, family = family, contrasts = 
##    contrasts, ", " data = data, quantiles = quantiles, E = E, 
##    offset = offset, ", " scale = scale, weights = weights, 
##    Ntrials = Ntrials, strata = strata, ", " lp.scale = lp.scale, 
##    link.covariates = link.covariates, verbose = verbose, ", " 
##    lincomb = lincomb, selection = selection, control.compute = 
##    control.compute, ", " control.predictor = control.predictor, 
##    control.family = control.family, ", " control.inla = 
##    control.inla, control.fixed = control.fixed, ", " control.mode 
##    = control.mode, control.expert = control.expert, ", " 
##    control.hazard = control.hazard, control.lincomb = 
##    control.lincomb, ", " control.update = control.update, 
##    control.lp.scale = control.lp.scale, ", " control.pardiso = 
##    control.pardiso, only.hyperparam = only.hyperparam, ", " 
##    inla.call = inla.call, inla.arg = inla.arg, num.threads = 
##    num.threads, ", " blas.num.threads = blas.num.threads, keep = 
##    keep, working.directory = working.directory, ", " silent = 
##    silent, inla.mode = inla.mode, safe = FALSE, debug = debug, ", 
##    " .parent.frame = .parent.frame)") 
## Time used:
##   Pre = 2.9, Running = 0.451, Post = 0.0164, Total = 3.37

1.3 Official homepage

See Installing INLA for additional information, but always use the testing version (unless you have very specific needs).

2 General information

The following resources are where you can find more information.

  • The INLA webpage
  • Write inla.doc("something") to learn more about it. Note that several pdf documents may pop up. Example inla.doc("poisson")
  • The discussion forum: Here you can search for other’s questions, and ask questions yourself

3 General troubleshooting

3.1 Problem with library(inla)

In some cases, if your output window for text is too small, library(inla) can fail. Please re-size your output window / console and try again.

3.2 Killing processes

In some cases you need to terminate inla() or inla.mesh functions. For example, if your R session dies unexpectedly, these C programs may still be running.

3.2.1 To kill a process on linux/mac

In the terminal / command line, write:

top -o MEM

This shows the processes as sorted by MEM (you may need to write %MEM). Then find your process “PID”. Quit the “top” (by pressing “q”), and write kill PID (where you replace PID with the PID number you found).

3.3 Model issues

If your inla run crashes in a “controlled” way, or if your inla results do not seem meaningful, look at the verbose output.

  • If the inla call runs, save the result$verbose to a .txt file
  • If the inla call crashes, use verbose=T and save the output to a .txt file

In both cases, looking at the last half of this file could help you, or you can send it to the discussion forum for help.

3.4 If your algorithm crashes for weird reasons

  1. Upgrade INLA: inla.upgrade(testing=T) (and try again)
  2. Re-install INLA and upgrade other packages (and try again)
  3. Re-install R and RStudio (or other) (and try again)