The R package polyCub (CRAN)

An R package providing methods for cubature (numerical integration) over polygonal domains. Note that for cubature over simple hypercubes, the packages cubature and R2Cuba might be more appropriate (cf. CRAN Task View: Numerical Mathematics).

The function polyCub() is the main entry point of the package. It is a wrapper around the following specific cubature methods.

General-purpose cubature rules:

Cubature rules for specific types of functions:

A Short History of the Package

For any spatio-temporal point process model, the likelihood contains an integral of the conditional intensity function over the observation region. If this is a polygon, analytical solutions are only available for trivial cases of the intensity function - thus the need of a cubature method over polygonal domains.

My Master’s Thesis (2010) on “Spatio-Temporal Infectious Disease Epidemiology based on Point Processes” is the origin of this package. Section 3.2 therein offers a more detailed description and benchmark experiment of some of the above cubature methods (and others).

The implementation then went into the surveillance package, where it is used to fit twinstim(), self-exciting two-component spatio-temporal point process models, described in Meyer et al (2012, Biometrics). In May 2013, I decided to move the cubature functionality into a stand-alone package, since it might be useful for other projects as well. Subsequently, I developed the isotropic cubature method polyCub.iso() to efficiently estimate point process models with a power-law distance decay of interaction (Meyer and Held, 2014, The Annals of Applied Statistics).