Julia INLA Ecosystem
A Julia-native reimplementation of the latent Gaussian model / INLA stack originally provided by R-INLA. The goal is not a line-by-line port but a composable, dispatch-based, SciML-aligned alternative covering the mainstream R-INLA workflows with native performance and genuine extensibility.
Status
v0.1.0-rc1. Phase A through D of the replan have landed: the four src/-bearing packages (GMRFs.jl, LatentGaussianModels.jl, INLASPDE.jl, INLASPDERasters.jl) cover the canonical R-INLA datasets — Scotland and Pennsylvania BYM2, Meuse zinc SPDE, the synthetic Negative Binomial / Gamma / Generic / Seasonal / Leroux / disconnected-Besag suite — within the testing strategy's tolerances. LGMTuring.jl provides the NUTS bridge for INLA-vs-MCMC triangulation.
What's here
- Getting started
- Areal — Scotland lip-cancer BYM2
- Temporal — Tokyo rainfall (cyclic RW2 + Bernoulli)
- Spatial — Meuse zinc SPDE
- Survival — Cox PH and Weibull on synthetic data
- Joint longitudinal + survival via
Copy - GMRFs.jl
- LatentGaussianModels.jl
- INLASPDE.jl
- INLASPDERasters.jl
- References
Installing
The packages are registered on a personal Julia registry at haavardhvarnes/JuliaRegistry. From a fresh Julia REPL:
using Pkg
Pkg.Registry.add(RegistrySpec(url = "https://github.com/haavardhvarnes/JuliaRegistry"))
Pkg.add("INLA") # umbrella: GMRFs + LatentGaussianModels + INLASPDETo install only one core package, substitute "INLA" for "GMRFs", "LatentGaussianModels", "INLASPDE", or "INLASPDERasters".
Optional sub-packages (LGMTuring.jl, LGMFormula.jl, GMRFsPardiso.jl) are not registered yet — install them by Pkg.develop-ing this repo's subdir directly, e.g.
Pkg.develop(url = "https://github.com/haavardhvarnes/INLA.jl",
subdir = "packages/LGMTuring.jl")How to read this site
- Getting started — the smallest possible Poisson + spatial random effect fit, top to bottom.
- Coming from R-INLA → Migration guide — side-by-side reference: every R-INLA
family,f(model = ...), prior, integration strategy, and post-fit accessor mapped to its Julia constructor or accessor function. Open this next to your R script while translating. - Coming from R-INLA → Formula DSL (
@lgm) — if your R-INLA workflow leans on the formula DSL, the@lgmmacro inLGMFormula.jlprovides a near-source-to-source migration path. Worked examples for Scotland BYM2 and beyond. - Vignettes — five end-to-end walkthroughs:
- Scotland BYM2 (areal Poisson with BYM2 spatial random effect),
- Tokyo rainfall (Bernoulli with a cyclic RW2 seasonal),
- Meuse zinc SPDE (Gaussian on point-referenced data via the SPDE–Matérn link),
- CoxPH and Weibull survival (right-censored time-to-event regression with the augmented piecewise-exponential and PH-Weibull pathways),
- Joint longitudinal + survival (Baghfalaki-style multi-likelihood model with
Copy-shared subject random effect).
- Packages — per-package overviews, exported API, and required contracts for extending them.
- References — the canonical method papers and validation datasets we test against.
Differences from R-INLA
A side-by-side surface map for every R-INLA construct currently covered (likelihoods, components, priors, accessors, prediction, sampling) lives in Coming from R-INLA → Migration guide. The full list of default-parameter parity calls lives in plans/defaults-parity.md. Highlights:
- Single dispatch table. Every latent component, likelihood, prior, and integration scheme is a struct + a handful of methods. Adding a new component is "subtype
AbstractLatentComponentand implement five methods" — no formula-DSL gatekeeping. LogDensityProblemsseam. The posterior is aLogDensityProblems-conformant object; downstream samplers (Turing, AdvancedHMC, custom) plug in without touching this package.- R-INLA-equivalent BYM2 scaling and PC priors by default. Where we differ, the docstring says so.
- No
f(...)/inla.formulamacro magic. A formula sugar layer (@lgm) exists inLGMFormula.jlfor users coming from R; the underlying constructor API is the source of truth.