MyNixOS website logo
Description

Linear Latent Non-Gaussian Models with Flexible Distributions.

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" <doi:10.48550/arXiv.2602.23987>.

The ngme2 Package

Description

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.

Features

  • Temporal processes: AR(1), Ornstein–Uhlenbeck, random walks, and ARMA models.
  • Spatial processes: Matérn fields (including graph-based meshes) and separable/non-separable space–time variants.
  • Non-Gaussian driven noise: NIG, generalized asymmetric Laplace, skew-(t); non-Gaussian measurement noise is also supported.
  • Joint and custom structures: bivariate type-G fields, longitudinal random-effects models, and user-defined operators via generic / generic_ns, flexible combinations of different models and driven noise.
  • Practical tools: kriging-style prediction, cross-validation helpers, and diagnostics for convergence/fit quality.

Quick start

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.

Installation

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.

Learn more

Metadata

Version

0.9.8

License

Unknown

Platforms (80)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    uefi
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-freebsd
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64-uefi
  • aarch64-windows
  • aarch64_be-none
  • arc-linux
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-linux
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • sh4-linux
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-uefi
  • x86_64-windows