Skip to content

Code for running examples in AGHQ method/theory paper

Notifications You must be signed in to change notification settings

awstringer1/aghq-paper-code

Repository files navigation

Bayesian Inference using Adaptive Gauss-Hermite Quadrature

This repository contains the code used to implement the examples in Stochastic Convergence Rates and Applications of Adaptive Quadrature in Bayesian Inference by Blair Bilodeau, Alex Stringer, and Yanbo Tang. A preprint and open access journal version are available.

The examples all make use of the aghq package, available on github as well as CRAN (install.packages("aghq")). A vignette for that package is also available. The code currently here uses version 0.4.0 of aghq.

Code files

The following files may be run to recreate the examples from the paper:

  • Section 4.1: file 12-disease-final.R.

  • Section 4.2: file 13-astro-final.R.

  • Section 5.2, S.7.1: file 05-loaloazip.R.

    • Takes a few hours at the resolution shown in the paper; the default in the script produces lower-resolution spatial interpolations and runs in 5 -- 10 minutes or so.

    • The MCMC run took 66 hours on my server. By default the domcmc flag is set to FALSE.

  • Section S.7.2: file 01-loaloazip-fixedintercept.R.

  • Section S.6: file 11-simulations-final.R.

  • Section S.7.3: file 06-loaloazipsims.R

    • Takes a few hours on my server, minutes on my M1 MacBook Pro.

All files save results in a created subdirectory of tempdir(). To find them, run tempdir() and go to that directory. The code will also print the location once it's done running.

You will need to install other packages from CRAN as necessary within each script. The only non-CRAN package is ipoptr which requires a working installation of IPOPT, see here. This is laborious and is only required for the astro example (Section 4.2). Everything else should be pretty straightforward to run.

About

Code for running examples in AGHQ method/theory paper

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published