Learn R Programming

⚠️There's a newer version (0.9.2) of this package.Take me there.

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:

  • polyCub.iso(): Efficient adaptive cubature for isotropic functions via line integrate() along the polygon boundary, as described in Supplement B of Meyer and Held (2014, The Annals of Applied Statistics)
  • polyCub.exact.Gauss() and circleCub.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).

Copy Link

Version

Install

install.packages('polyCub')

Monthly Downloads

992

Version

0.6.1

License

GPL-2

Issues

Pull Requests

Stars

Forks

Maintainer

Sebastian Meyer

Last Published

October 2nd, 2017

Functions in polyCub (0.6.1)

makegrid

Constructs Equally-Spaced Grid
plot_polyregion

Plots a Polygonal Domain (of Various Classes)
dotprod

Dot/Scalar Product of Two Vectors
gpclibPermit

gpclib Licence Acceptance
isClosed

Check if Polygon is Closed
isScalar

Checks if Argument is Scalar
vecnorm

Euclidean Vector Norm (Length)
xylist

Convert Various Polygon Classes to a Simple List of Vertices
plotpolyf

Plot Polygonal Domain on Image of Bivariate Function
polyCub-package

Cubature over Polygonal Domains
coerce-gpc-methods

Conversion between polygonal "owin" and "gpc.poly"
coerce-sp-methods

Coerce "SpatialPolygons" to "owin"
polyCub

Wrapper Function for the Various Cubature Methods
polyCub.SV

Product Gauss Cubature over Polygonal Domains
polyCub.exact.Gauss

Quasi-Exact Cubature of the Bivariate Normal Density
polyCub.iso

Cubature of Isotropic Functions over Polygonal Domains
checkintrfr

Check the Integral of \(r f_r(r)\)
circleCub.Gauss

Integration of the Isotropic Gaussian Density over Circular Domains
polyCub.midpoint

Two-Dimensional Midpoint Rule
polygauss

Calculate 2D Nodes and Weights of the Product Gauss Cubature