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:
polyCub.midpoint(): Two-dimensional midpoint rule (a simple wrapper aroundspatstat'sas.im.function())polyCub.SV(): Product Gauss cubature as proposed by Sommariva and Vianello (2007, BIT Numerical Mathematics)
Cubature rules for specific types of functions:
polyCub.iso(): Efficient adaptive cubature for isotropic functions via lineintegrate()along the polygon boundary, as described in Supplement B of Meyer and Held (2014, The Annals of Applied Statistics)polyCub.exact.Gauss()andcircleCub.Gauss(): Quasi-exact methods specific to the integration of the bivariate Gaussian density over polygonal and circular domains, respectively
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).