Package: adlaplace 0.7.4

adlaplace: Laplace Approximations Using Automatic Differentiation

Computes Laplace-approximate maximum likelihood for hierarchical and latent Gaussian models. A formula interface specifies observation densities (e.g. Gaussian, negative Binomial), fixed effects, and random terms (independent effects, smoothing terms). Customized response distributions and models for random effects can be specified through a low-level interface or by writing interoperable packages. Derivatives are computed using automatic differentiation with 'CppAD', and used in trust region optimization to find modes of random effects. Derivatives of the Laplace approximation of the log-likelihood are computed using third order contractions and is compatible with custom atomics. The approach follows Kristensen, Nielsen, Berg, Skaug, and Bell (2016) <doi:10.18637/jss.v070.i05>.

Authors:Patrick Brown [aut, cre, cph]

adlaplace_0.7.4.tar.gz
adlaplace_0.7.4.zip(r-4.7-x86_64)adlaplace_0.7.4.zip(r-4.7-arm64)adlaplace_0.7.4.zip(r-4.6-x86_64)adlaplace_0.7.4.zip(r-4.6-arm64)adlaplace_0.7.4.zip(r-4.5-x86_64)
adlaplace_0.7.4.tgz(r-4.6-x86_64)adlaplace_0.7.4.tgz(r-4.6-arm64)adlaplace_0.7.4.tgz(r-4.5-x86_64)adlaplace_0.7.4.tgz(r-4.5-arm64)
adlaplace_0.7.4.tar.gz(r-4.7-arm64)adlaplace_0.7.4.tar.gz(r-4.7-x86_64)adlaplace_0.7.4.tar.gz(r-4.6-arm64)adlaplace_0.7.4.tar.gz(r-4.6-x86_64)
adlaplace_0.7.4.tgz(r-4.6-emscripten)
manual.pdf |manual.html✨
DESCRIPTION
card.svg |card.png
adlaplace/json (API)

# Install 'adlaplace' in R:
install.packages('adlaplace', repos = c('https://eborgnine.r-universe.dev', 'https://cloud.r-project.org'))

Bug tracker:https://github.com/eborgnine/adlaplace/issues

Uses libs:
  • c++– GNU Standard C++ Library v3
  • openmp– GCC OpenMP (GOMP) support library
Datasets:
  • dat - Example GAMM simulation data
  • germany - Germany oral cavity cancer
  • london - London daily mortality and PM10

On CRAN:

Conda:

cppopenmp

6.46 score 1 stars 3 packages 68 exports 7 dependencies

Last updated from:e1ec96a880 (on main). Checks:15 OK. Indexed: yes.

TargetResultTimeFilesSyslog
linux-devel-arm64OK225
linux-devel-x86_64OK216
source / vignettesOK615
linux-release-arm64OK209
linux-release-x86_64OK245
macos-release-arm64OK262
macos-release-x86_64OK525
macos-oldrel-arm64OK176
macos-oldrel-x86_64OK375
windows-devel-arm64OK461
windows-devel-x86_64OK349
windows-release-arm64OK345
windows-release-x86_64OK309
windows-oldrel-x86_64OK322
wasm-releaseOK148

Exports:.model_role_levelsad_packad_pack_dropad_pack_ptrad_pack_set_Xadlaplaceaghq_ffamip_setapply_theta_logbeta_infobinomby_groupclone_ad_pack_ptrcollect_termsdensity_dataderiv_scan_jointderiv_scan_laplacedesigndirichlet_multinomelgm_matrixextra_densityfit_outerformat_parametersfpolyfun_obj_fdfhgradgrad_obs_unitshas_openmphessianhinv_trace_indexiidinfluence_scoresinner_optinterceptiwpjoint_log_denslaplace_half_H_invlaplace_logliklinearlog_lik_laplacemean_mvquadmodel_datan_groupsn_obs_unitsnbinomnormalobs_groupsobs_groups_unitsouter_fnouter_grphi_gammapoisprecisionpriorrandom_inforef_alignreplace_varsrmvnldlrpolysim_fitsim_iidsim_randomsizesstrip_term_nametakahashi_davisterm_data_setuptheta_infotrace_hinv_t

Dependencies:data.tablelatticeMatrixRcppRCppADRcppEigentrustOptim

Approximate maximum influence perturbations
Introduction | Case-crossover: PM10 at 80 | Fit (outer MLE) | Quantity of interest and influence scores | Approximate most influential set | Confirm by dropping nominated strata | Refit without AMIP strata | Bacteria: sign-flip of the drug effect | Notes

Last update: 2026-10-08
Started: 2026-09-11

Bayesian Bernoulli mixed model for the bacteria data
Data | Model | Adaptive Gauss–Hermite quadrature | Posterior of (\sigma) | Fitted probabilities and child effects

Last update: 2026-09-28
Started: 2026-08-27

BYM disease mapping: Germany oral cavity cancer
Introduction | Data | Building AD shards | Combining shards | Joint log density derivatives | Inner optimization | Joint density derivative checks | Profile likelihood | Outer optimization | Spatial effects

Last update: 2026-09-28
Started: 2026-07-17

Case-crossover models with adlaplace
Introduction | Data | Model specification | Fit | AD development check | Joint log density | Likelihood

Last update: 2026-09-28
Started: 2026-07-21

GAMM Examples
check by shard | Profile derivative checks | Joint density derivative checks

Last update: 2026-09-28
Started: 2026-07-17

Laplace Approximations with adlaplace
Model | Simulated data | Building AD shards | Observations and hyperparameters | Random effects | Observation likelihood check | Combining shards | Joint log density derivatives | Inner optimization | likelihood | Outer optimization | Derivative checks | Joint density derivative checks | nicer interface | mean estimation

Last update: 2026-09-28
Started: 2025-11-26

Equivalence to Conditional Gamma-Poisson Model
\begin{equation}\label{eq:multinom}P(\mathbf{y} \mid \boldsymbol{\lambda}, \sum_{k=1}^K Y_k = N) | \begin{equation}\label{eq:dm}P(\mathbf{y} \mid \alpha, \boldsymbol{\mu}, N) | Simplificaiton | \begin | \begin{equation}\label{eq:dm_ratio}P(\mathbf{y} \mid \alpha, \boldsymbol{\mu}, N)

Last update: 2026-09-11
Started: 2026-07-21

Readme and manuals

Help Manual

Help pageTopics
Valid model type factor levels.model_role_levels
Build AD function with Hessian templatesad_pack ad_pack,ad_pack_ptr-method ad_pack,density_data-method ad_pack,list-method
Retape an AD pack after dropping observation unitsad_pack_drop
Build raw AD handle for one density shardad_pack_ptr
Raw AD handle (external pointer)ad_pack_ptr-class
Rebuild an 'ad_pack' for a new model-data designad_pack_set_X
AD function with Hessian templates attachedad_pack-class
Fit a hierarchical model by Laplace-approximate maximum likelihoodadlaplace
C++ backend entry pointsadlaplace_cpp fun_obj_fdfh grad hessian joint_log_dens trace_hinv_t
Methods for fitted adlaplace modelsadlaplace_fit-methods coef.adlaplace_fit confint.adlaplace_fit fitted.adlaplace_fit logLik.adlaplace_fit nobs.adlaplace_fit plot.adlaplace_fit predict.adlaplace_fit print.adlaplace_fit print.summary.adlaplace_fit summary.adlaplace_fit vcov.adlaplace_fit
Build 'aghq' objective list from an adlaplace fitaghq_ff
Approximate most influential removal set (AMIP)amip_set
Apply log transform to selected theta columnsapply_theta_log
Binomial observation termbinom binomial-class
By-Group Classes and Functionsby_group
By-Group Classby_group-class
Combine 'ad_pack_ptr' handlesc.ad_pack_ptr
Deep copy of an 'ad_pack_ptr' handleclone_ad_pack_ptr
Parse Model Terms from Formulacollect_terms
Per-shard layout for AD density evaluationdensity_data density_data-class
Scan joint log-density AD derivatives vs finite differencesderiv_scan_joint
Scan Laplace profile AD derivatives vs finite differencesderiv_scan_laplace
Dirichlet-multinomial case-crossover response termdirichlet_multinom
Dirichlet-multinomial response termbeta_info,dirichlet_multinom-method design,dirichlet_multinom-method dirichlet_multinom-class elgm_matrix,dirichlet_multinom-method precision,dirichlet_multinom-method random_info,dirichlet_multinom-method theta_info,dirichlet_multinom-method
Outer optimization scaffolding for Laplace profile likelihoodsfit_outer
Format Laplace estimates using parameter metadataformat_parameters
Fixed Polynomial Model Termbeta_info,fpoly-method design,fpoly-method fpoly fpoly-class
Example GAMM simulation datadat gamm
Gaussian observation termgaussian-class normal theta_info,gaussian-method
Germany oral cavity cancer (Besag-York-Mollie example)germany
Per-unit observation gradients (streaming, grad-only tapes)grad_obs_units
Whether this build was compiled with OpenMP support.has_openmp
Positions of a shard's quadratic form inside the joint inverse Hessianhinv_trace_index hinv_trace_index,density_data-method
IID Random Effects Termdesign,iid-method iid iid-class precision,iid-method random_info,iid-method theta_info,iid-method
Per-unit influence scores for an inner linear functionalinfluence_scores
Inner optimization over gamma using trust-region CG (sparse)inner_opt
intercept Model Termbeta_info,intercept-method design,intercept-method intercept intercept-class precision,intercept-method random_info,intercept-method
Integrated Wiener Process Term Constructoriwp
Integrated Wiener Process Termdesign,iwp-method iwp-class precision,iwp-method random_info,iwp-method theta_info,iwp-method
Extract inner inverse Cholesky factor from Laplace outputlaplace_half_H_inv
Laplace-approximate log-likelihood (positive convention)laplace_loglik
Linear Model Termbeta_info,linear-method design,linear-method linear linear-class precision,linear-method random_info,linear-method
Log-likelihood with inner Laplace optimizationlog_lik_laplace
London daily mortality and PM10 (case-crossover example)london
Posterior mean of random effects via multivariate quadraturemean_mvquad
Assemble model terms and per-shard 'density_data' objectsmodel_data
Base Model Classmodel_term-class
Model Term Genericsbeta_info beta_info,model_term-method design design,model_term-method elgm_matrix extra_density extra_density,model_term-method model-generics precision precision,model_term-method random_info random_info,model_term-method theta_info theta_info,model_term-method
Number of AD shards in an 'ad_pack_ptr' handlen_groups
Number of removable observation unitsn_obs_units
Negative binomial observation termnbinom nbinom-class theta_info,nbinom-method
Partition observations into AD shards by sparsity patternobs_groups
Build 'obs_groups' for a subset of observation unitsobs_groups_units
Outer objective and gradient wrappersouter_fn outer_gr outer_optim_wrappers
Linear functional of the inner field gammaphi_gamma
Poisson observation termpois poisson-class
Hyperparameter prior termprior prior-class
Replace data-column names in model termsreplace_vars replace_vars,dirichlet_multinom-method replace_vars,formula-method replace_vars,list-method replace_vars,model_term-method
Simulate from a multivariate normal using LDL of the precision matrixrmvnldl
Random Polynomial Model Termdesign,rpoly-method precision,rpoly-method random_info,rpoly-method rpoly rpoly-class
Simulate linear predictors on a new covariate gridsim_fit
Simulate IID random effects with pointwise and global intervalssim_iid
Simulate a random-effect contribution for one covariatesim_random
Parameter-block row counts for an 'density_data'sizes sizes,density_data-method
Sparse inverse subset of a symmetric positive-definite matrixtakahashi_davis
Build design matrices and parameter metadata from a formulaterm_data_setup