/anclik

C implementation of ANC HIV prevalence likelihood described by Alkema, Raftery, Clark (2007)

Primary LanguageC

This implements the random effects likelihood for ANC HIV prevalence described by
Alkema, Raftery, Clark Ann Appl Stat 2007 (http://dx.doi.org/10.1214/07-AOAS111).
This is implemented in the EPP model used by UNAIDS for generating HIV epidemic
trends: http://www.unaids.org/en/dataanalysis/datatools/spectrumepp2013.

The code is implemeted as an R package in the subdirectory anclik/. To install the
R package using devtools:

> devtools::install_github("jeffeaton/anclik")


The script "R/anclik.R" includes a function for preparing ANC data for likelihood
calculation and a wrapper function for calling the C function. This includes
an equivalent R implementation of the C code.

The script "example.R" provides an example for preparing the data and
calling the likelihood, and compares the performance of the C and R
implementations.


The initial implementation relied on GNU Scientific Library (GSL) for
adapative Gaussian quadrature numerical intergration routine
(http://www.gnu.org/software/gsl/). This deprecated version is retained in
"gsl/anclikR_gsl.c". To compile that version add the flags -lgsl -lgslcblas:

$ R CMD SHLIB -lgsl -lgslcblas anclikR_gsl.c anclik.c mvrandist.c

You may need to supply -L <path to GSL> if not in the PATH variable.

At present, it does not handle the GSL errors, so in this version if an error
happens in the C code (e.g. pass it a vector of incorrect size), it will crash R.
Hopefully I’ll improve this in the future. 


GPLv3, no warranty, etc...

Created by Jeff Eaton on 2014-11-12 <jeffrey.eaton@imperial.ac.uk>
Edited by  Jeff Eaton on 2014-11-24
Edited by  Jeff Eaton on 2016-05-29: Remove dependency on GSL
Edited by  Jeff Eaton on 2022-02-23: Move R package to top level, GSL version to `gsl/`