Fits and analyzes linear latent non-Gaussian models for
temporal, spatial, and space-time data. The package provides model
components for autoregressive and Ornstein-Uhlenbeck processes, random
walks, Matern fields based on stochastic partial differential equations,
separable and non-separable space-time models, graph-based Matern models,
bivariate type-G fields, and user-defined sparse operators. Latent fields
and observation models can use Gaussian and non-Gaussian noise
distributions, including normal inverse Gaussian, generalized asymmetric
Laplace, and skew-t distributions. Functions are included for simulation,
likelihood-based estimation, prediction, cross-validation, convergence
diagnostics, stochastic gradient optimization, batch-means confidence
intervals, and posterior-like sampling. The modeling framework is described
in Bolin, Jin, Simas and Wallin (2026) "A Unified and Computationally
Efficient Non-Gaussian Statistical Modeling Framework"
ngme2 Package 
ngme2 (https://davidbolin.github.io/ngme2/) is a unified, efficient, and flexible framework for fitting latent non-Gaussian models in R. It extends the SPDE-based Gaussian modeling toolkit to handle skewness, heavy tails, and non-smooth behavior while keeping familiar workflows for estimation, prediction, and model assessment.
generic / generic_ns, flexible combinations of different models and driven noise.library(ngme2)
time_index <- seq(1, 1000, by = 1)
n <- length(time_index)
# Define the AR(1) model with NIG driven noise
ar1_nig <- f(time_index,
model = ar1(rho = 0.7),
noise = noise_nig(mu = 3, sigma = 2, nu = 0.5)
)
# Simulate the AR(1) process with NIG driven noise
nig_field <- simulate(ar1_nig, seed = 123, nsim = 1)[[1]]
Y <- nig_field + rnorm(n, mean = 0, sd = 1)
plot(time_index, nig_field, type = "l")
# Fit the model
fit <- ngme(
formula = Y ~ 0 + f(time_index, model = ar1(), noise = noise_nig()),
data = data.frame(Y = Y, time_index = time_index),
family = "normal" # likelihood family
)
summary(fit)
Use ngme_optimizers() to see available optimizers and configure stochastic gradient settings via control_opt.
The stable version can be installed with:
install.packages("ngme2", repos = "https://davidbolin.github.io/ngme2/")
See the Installation and Configuration vignette if compilation tools are needed.