athowes / beyond-borders

Evaluating the suitability of spatial adjacency for small-area estimation
https://athowes.github.io/beyond-borders
MIT License
2 stars 1 forks source link
random-effects-model small-area-estimation spatial-statistics

beyond-borders

Code for the manuscript Howes, Eaton, Flaxman "Beyond borders: evaluating the suitability of spatial adjacency for small-area estimation" (in preparation).

Small-area estimation models typically use the Besag model, a type of Gaussian Markov random field, to model spatial structure.

However, for irregular geometries, the assumptions made by the Besag model do not seem plausible. The Besag model was designed to work well for grids, as are used in image analysis, but in small-area estimation the geometries we encounter, like the districts of a country, are more irregular.

The goal of this work is to determine whether or not, in practice, this matters. To do so, we consider the performance of eight inferential small-area models:

Model Function
Constant constant_aghq
Independent and identically distributed iid_aghq
Besag besag_aghq
Besag-York-Mollié 2 bym2_aghq
Centroid kernel (fixed lengthscale) fck_aghq
Integrated kernel (fixed lengthscale) fik_aghq
Centroid kernel ck_aghq
Integrated kernel ik_aghq

We use the aghq package for adaptive Gauss-Hermite quadrature over a marginal Laplace approximation to conduct approximate Bayesian inference for each of the models. Where possible, alternative implementions using TMB, tmbstan, R-INLA and rstan are provided by the arealutils package.

R package dependencies

This analysis is supported by the arealutils package (I'd usually use the name areal.utils but C++ doesn't like having . in package names) which can be installed from Github via:

devtools::install_github("athowes/arealutils")

The aghq package is available from CRAN, though the latest development version can be installed from Github via:

devtools::install_github("awstringer1/aghq")

Additionally, if required, the R-INLA package is not currently available on CRAN, and instead may be installed by following instructions from the project website.

File structure

The directories of this repository are:

Directory Contains
make Scripts used to run the reports. _make.R runs everything in order.
misc Miscellaneous code, not used as part of orderly.
src All orderly reports.
utils Helper scripts for common development tasks.

Within the src directory, reports are prefixed by a number (0-2) designating:

Prefix Description
0 Applicable to both studies.
1 Corresponds to the study on synthetic data.
2 Corresponds to the study on HIV data from household surveys in sub-Saharan Africa.

orderly

We use the orderly package (RESIDE, 2020) to simplify the process of doing reproducible research. After installing orderly (from either CRAN or Github) a report, let's say called example, may be run by:

orderly::orderly_run(name = "src/example")

The results of this run will appear in the draft/ folder (ignored on Github). To commit the draft (with associated id) to the archive/ folder (also ignored on Github, and which should be treated as "read only") use:

orderly::orderly_commit(id)

Any outputs of this report will then be available to use as dependencies within other reports.