The R package polyCub provides methods for cubature
(numerical integration) over polygonal domains.
polyCub() is the main entry point of the package.
It is a wrapper around the specific cubature methods listed below.
Two-dimensional midpoint rule.
Polygons are converted to binary pixel images
as.im.function method from package
spatstat (Baddeley and Turner, 2005).
The integral is then obtained as the sum over
(pixel area * f(pixel midpoint)).
Product Gauss cubature as proposed by Sommariva and Vianello (2007).
Efficient adaptive cubature for isotropic functions via line
integrate() along the polygon boundary, see Meyer and Held
(2014, Supplement B, Section 2.4).
Quasi-exact method specific to the integration of the bivariate Gaussian
density over polygonal domains. It is based on formulae from Chapter 26 of
the Abramowitz and Stegun (1972) handbook, i.e. triangulation of the
polygonal domain (using
tristrip of package
gpclib) and appropriate evaluations of
pmvnorm from package mvtnorm.
Note that there is also a function
to perform integration of the isotropic Gaussian density over
See Section 3.2 of Meyer (2010) for a more detailed description and benchmark experiment of some of the above cubature methods (and others).
Abramowitz, M. and Stegun, I. A. (1972). Handbook of Mathematical Functions with Formulas, Graphs, and Mathematical Tables. New York: Dover Publications.
Baddeley, A. and Turner, R. (2005). spatstat: an R package for analyzing spatial point patterns. Journal of Statistical Software, 12 (6), 1-42.
Meyer, S. (2010). Spatio-Temporal Infectious Disease Epidemiology based on Point Processes. Master's Thesis, LMU Munich. Available as http://epub.ub.uni-muenchen.de/11703/.
Sommariva, A. and Vianello, M. (2007). Product Gauss cubature over polygons based on Green's integration formula. Bit Numerical Mathematics, 47 (2), 441-453.
The packages cubature and R2Cuba, which are more appropriate for cubature over simple hypercubes.