# rect.integrate: Density integration on the two-dimensional simplex In lbelzile/BMAmevt: Multivariate Extremes: Bayesian Estimation of the Spectral Measure

## Description

The integral is approximated by a rectangular method, using the values stored in matrix `density`.

## Usage

 `1` ```rect.integrate(density, npoints, eps) ```

## Arguments

 `density` A `npoints*npoints` matrix containing the density's values scattered on the discretization grid defined by `npoints, equi, eps` (see `discretize`). `npoints` The number of grid nodes on the squared grid containing the desired triangle. `eps` Positive number: minimum distance from any node inside the simplex to the simplex boundary

## Details

Integration is made with respect to the Lebesgue measure on the projection of the simplex onto the plane (x,y): x > 0, y > 0, x+y < 1. It is assumed that `density` has been constructed on a grid obtained via function `discretize`, with argument `equi` set to `FALSE` and `npoints` and `eps` equal to those passed to `rect.integrate`.

## Value

The value of the estimated integral of `density`.

## Examples

 ``` 1 2 3 4 5 6 7 8 9 10 11``` ```wrapper <- function(x, y, my.fun,...) { sapply(seq_along(x), FUN = function(i) my.fun(x[i], y[i],...)) } grid <- discretize(npoints=40,eps=1e-3,equi=FALSE) Density <- outer(grid\$X,grid\$Y,FUN=wrapper, my.fun=function(x,y){10*((x/2)^2+y^2)}) rect.integrate(Density,npoints=40,eps=1e-3) ```

lbelzile/BMAmevt documentation built on June 13, 2019, 12:43 p.m.