Skip to contents

Front door

The main fitter, its formula surface, and the mode / family helpers.

tulpa()
Fit a tulpa model
tulpa_parse_formula()
Parse a mixed-model formula
findbars()
Find all bar terms in a formula's parse tree
nobars()
Remove all bar terms from a formula's parse tree
inference_mode_info()
Print inference mode information
validate_mode()
Validate that a fit used the expected mode
tulpa_family()
Construct a minimal tulpa_family for simulation
tulpa_gaussian()
Fit a Gaussian linear model via tulpa's generic engine
tulpa_build_model_data()
Build model matrices from a parsed formula
tulpa_simulate()
Simulate data from a tulpa model

Tier 2 – structured approximations

Laplace, nested Laplace, and the free-Sigma random-effect backends.

tulpa_laplace()
Fit a model via Laplace approximation
tulpa_laplace_beta()
Fit a beta-regression model via Laplace, estimating the precision
tulpa_nested_laplace()
Nested Laplace approximation for latent Gaussian models
tulpa_nested_laplace_joint()
Joint multi-likelihood nested Laplace approximation
fit_st_nested()
Fit an additive spatiotemporal GLM by nested Laplace
tulpa_hyper_grid()
Outer hyperparameter-grid integration with a user-supplied inner fit
tulpa_re_cov_nested()
Nested-Laplace integration over random-effect covariances
tulpa_re_aghq()
Adaptive Gauss-Hermite refinement of a grouped random-effect covariance
tulpa_eb()
Empirical-Bayes random-effect covariances
tulpa_em_laplace()
Fit a latent-variable model via EM + Laplace approximation
tulpa_em_mc()
Generic Monte-Carlo EM driver
agq_fit()
Adaptive Gauss-Hermite quadrature for one-RE GLMMs
fit_spde()
Fit a Spatial Model using SPDE Laplace Approximation
tulpa_ep()
Expectation-Propagation fit for a GLM
tulpa_multinomial()
Multinomial (nominal K-class) logistic regression via Laplace
tulpa_ordinal()
Ordinal (ordered K-class) cumulative-logit regression via Laplace
imh_laplace()
Independence Metropolis-Hastings with Laplace proposal

Tier 1 – exact MCMC and debias

tulpa_gibbs()
Fit via Polya-Gamma Gibbs sampler
tulpa_re_cov_gibbs()
Gibbs estimation of random-effect covariances (exact-target debias)
tulpa_nuts_beta()
Fit a beta-regression model via NUTS (joint sampling of beta + log_phi)
tulpa_nuts_spde()
Sample an SPDE GLM via NUTS, optionally jointly over Matern hypers
tulpa_tgmrf()
Fit a custom tgmrf latent block
tgmrf()
User-defined GMRF latent block
tgmrf_cpp()
User-defined GMRF latent block, compiled C++ backend
tulpa_cache_dir()
Default cache directory for tgmrf_cpp()-compiled DLLs
tulpa_cache_clear()
Remove compiled blocks from the tgmrf_cpp() cache
mala()
Metropolis-Adjusted Langevin Algorithm (MALA)
tulpa_integrator()
Select the symplectic integrator for HMC and NUTS
with_tulpa_integrator()
Run an expression under a chosen symplectic integrator

Other approximations

pathfinder()
Pathfinder: variational warm-start via L-BFGS + ELBO scoring
bridge_sampling()
Bridge sampling for marginal likelihood

Latent structure

Spatial, temporal, and varying-coefficient constructors.

spatial()
Areal spatially varying coefficient field
spatial_car()
CAR / ICAR spatial structure
spatial_car_proper()
Proper CAR spatial structure
spatial_bym2()
BYM2 spatial structure
spatial_gp()
Gaussian process spatial structure (NNGP)
spatial_multiscale()
Multi-Scale Gaussian Process spatial structure
spatial_svc()
Spatially varying coefficient structure
spatial_rsr()
Restricted Spatial Regression (RSR)
spatial_spde()
SPDE Spatial Field (Matern via Triangular Mesh)
spatial_spde_custom()
SPDE Spatial Field from Custom Matrices
temporal_rw1()
RW1 temporal structure (First-order Random Walk)
temporal_rw2()
RW2 temporal structure (Second-order Random Walk)
temporal_ar1()
AR1 temporal structure (First-order Autoregressive)
temporal_ar2()
AR(2) temporal latent field (second-order autoregressive)
temporal_ar()
AR(p) temporal latent field (general-order autoregressive)
temporal_gp()
Gaussian Process temporal structure
temporal_multiscale()
Multi-scale temporal structure
temporal_tvc()
Time-varying coefficient structure
temporal_rtr()
Restricted temporal regression (RTR)
spatiotemporal()
Spatiotemporal interaction specifications for tulpa
spatiotemporal_gp()
Non-separable spatiotemporal GP
svc()
Extract spatially-varying coefficients from a fitted model
tvc()
Extract temporally-varying coefficients from a fitted model
latent()
Mark an expression as a latent block in a tulpa formula
latent_factor()
Create a latent factor specification
adjacency()
Construct a spatial adjacency graph for areal models
check_adjacency()
Validate a spatial adjacency matrix
node_index()
Map cell identifiers to graph node indices
compute_nngp_neighbors()
Compute nearest neighbors for NNGP
tulpa_bar_field_specs()
Expand a varying-coefficient bar into per-column field specs
tulpa_bar_field_replicate()
Replicate an areal graph across the levels of a factor (replicated CAR)
tulpa_is_spatial_bar()
Recognize an inline varying-coefficient bar

Priors

The prior surface and the individual prior builders.

tulpa_priors()
Prior specification for tulpa models
priors_default()
Show default priors for a tulpa family
prior_from_spec()
Build a prior list for tulpa_nested_laplace() from a tulpa spec object
prior_normal()
Normal prior
prior_beta()
Beta prior
prior_gamma()
Gamma prior
prior_exponential()
Exponential prior
prior_half_cauchy()
Half-Cauchy prior
prior_half_normal()
Half-normal prior
prior_pc()
Penalized complexity (PC) prior
re_cov_pc_lkj_prior()
PC + LKJ hyperprior for a random-effect covariance

Methods, criteria, and prediction

tulpa_criteria()
Model criteria from a pointwise log-likelihood
dic() cpo()
DIC and CPO
tulpa_kfold()
K-fold cross-validation for a tulpa fit
tulpa_reloo()
Selective refit of high-Pareto-k observations (reloo)
tulpa_psis()
Pareto-smoothed importance sampling
tulpa_loglik()
Streaming pointwise log-likelihood
bayes_R2()
Bayesian R-squared
tulpa_powerscale_sensitivity()
Power-scaling prior / likelihood sensitivity
compare_models()
Compare models by information criteria
model_average()
Model-averaged predictions
posterior_predict()
Posterior predictive replicates
pp_check()
Posterior predictive check
prior_predict()
Prior predictive simulation
reexports tidy glance
Objects exported from other packages

Reading a fit

Accessors for a fitted model: the coefficient surface, the posterior draws in whatever representation the backend produced, and the extracted latent effects.

fixef()
Fixed-effect coefficients (lme4-compatible)
ranef()
Random-effect summaries
VarCorr()
Random-effect variances and correlations
posterior_sample()
Posterior parameter sample from a fit
mcmc_draws()
MCMC chain draws from a fit
tulpa_posterior_draws()
Posterior draws from a nested-Laplace fit
tulpa_draws_array()
Posterior draws as a 3D array
as_draws() as_draws_array() as_draws_matrix() as_draws_df() as_draws_rvars()
Posterior draws in the posterior package's format
temporal()
Extract temporal effects from a fitted model
spatiotemporal_effects()
Extract spatiotemporal effects from fitted model
smooth_effects()
Extract fitted covariate smooths
latent_factors()
Extract latent factor posteriors from fit

Diagnostics

Convergence for sampled fits, approximation reliability for deterministic ones, and the residual / goodness-of-fit surface both share.

diagnostics()
Posterior diagnostics for a fitted model
mcmc_diagnostics() deprecated
MCMC convergence diagnostics
laplace_diagnostics() deprecated
Approximation-reliability diagnostics for a deterministic nested-Laplace fit
check_diagnostics()
Quick convergence check
diagnostic_summary()
Comprehensive Diagnostic Summary
select_main_params()
Select the "main" model parameters for diagnostic display
n_divergent()
Number of divergent transitions
geweke_test()
Geweke Convergence Test
moran_i()
Moran's I test for spatial autocorrelation in residuals
durbin_watson()
Durbin-Watson test for temporal autocorrelation
tulpa_variogram()
Empirical semivariogram of residuals
pit_residuals()
PIT (Probability Integral Transform) residuals
tulpa_pit()
Probability integral transform from a predictive CDF
test_uniformity()
Test uniformity of PIT residuals
test_dispersion()
Test for over- or underdispersion
test_outliers()
Test for outliers (simulation envelope)
test_zero_inflation()
Test for zero inflation
check_model()
Diagnostic panel plot
spatial_range()
Extract spatial range and variance from a fitted spatial model
temporal_corr()
Extract temporal correlation parameters from a fitted model
post_hoc_lm()
Fit a post-hoc linear model on estimated parameters

Calibration

Simulation-based calibration. Where the diagnostics above score one fit, these score whether an inference algorithm’s posteriors are calibrated across the generative model, by reading the whole marginal CDF.

sbc() summary(<sbc>) plot(<sbc>)
Simulation-based calibration
sbc_mixture() sbc_normal() sbc_discrete() sbc_rank() sbc_draws()
Predictive shapes an SBC fitter reports

Plots

plot_rhat()
Plot Rhat Convergence Diagnostic
plot_ess()
Plot Effective Sample Size Diagnostic
plot_acf()
Plot Autocorrelation Functions
plot_energy()
Plot Energy Diagnostic (E-BFMI)
plot_divergences()
Plot Divergent Transitions
plot_pairs()
Plot Bivariate Parameter Posteriors (Pairs Plot)
plot_diagnostics()
Diagnostic Plotting Functions for tulpa Models
plot_map()
Plot spatial predictions as a map
plot_map_panel()
Plot multiple maps in a grid

Outer-grid integration and utilities

The node designs the outer hyperparameter integration is laid on, the axis-provenance surface, and the small numerical helpers.

ccd_grid()
Central Composite Design (CCD) grid for nested-Laplace integration
ccd_weights()
Corrected R-INLA CCD integration weights
ccd_to_theta()
Map standardised CCD coordinates to physical hyperparameters
hyper_axis_spec()
Describe one outer-grid hyperparameter axis
auto_grid()
Mark an outer-grid setting as a default rather than a pin
is_auto_grid()
Is an outer-grid setting marked as a default?
rubins_pool()
Pool multiple imputation draws via Rubin's rules
sn_cdf()
Skew-normal CDF
sn_quantile()
Skew-normal quantile
sn_match()
Match three cumulants to a skew-normal parameterisation
tulpa_profile()
Profile the inner Laplace solve by phase
tulpa_check_control()
Validate a control = list() surface against its canonical key set