# GetApprox: Approximate a copula by a histogram density In SimCop: Simulate from Arbitrary Copulae

## Description

Approximates the “density” of a copula by a piece-wise constant function.

## Usage

 ```1 2``` ```GetApprox(Cop, dim = 2, depth = ifelse(type == 1, 10, 32), type = 1, TOL = 1000 * .Machine\$double.eps) ```

## Arguments

 `Cop` A function defining the copula. `dim` The approximation should be calculated on the dim-dimensional unit cube, defaults to 2. `depth` The number of hyperrectangles to be used to devide the unit cube, defaults to 10 for Approximation I and to 32 for Approximation II. `type` Whether Approximation I or Approximation II should be used, defaults to one. `TOL` A numerical tolerance used when calculating Approximation I.

## Details

This function provides two methods for subdividing the d-dimensional unit cube into hyper-rectangles, with d being passed to the parameter `dim`. As most of the functions in this package which create a new copula return a function that can be evaluated at points in arbitrary dimensions, it is necessary to specify for which dimension d one wishes to calculate the approximation to the copula's “density”.

The first method (Approximation I) determines 2^m hyper-rectangles (where m is the parameter `depth`), each containing the same probability mass with respect to the copula. The second method (Approximation II) dividies the unit cube into m^d hyper-squares.

These approximations can be interpreted as piecewise constant approximations of the copula's probability density function if the copula is absolutely continuous. For futher details see ‘References’.

## Value

`GetApprox` returns an object of `class` ‘CopApprox’ according to its inputs. The returned object is a list containing a matrix that holds the information of the approximation, the argument `Cop`, which approximation was determined, and other auxiliary information.

The only method for objects of class ‘CopApprox’ implemented so far are for the generic function `plot`, and then only for the case if `dim` was 2.

## Author(s)

Berwin A. Turlach <berwin.turlach@gmail.com>

## References

Tajvidi, N. and Turlach, B.A. (2017). A general approach to generate random variates for multivariate copulae, Australian & New Zealand Journal of Statistics. Doi:10.1111/anzs.12209.

`plot.CopApprox`
 ```1 2 3``` ```Cop <- NewMEVGumbelCopula(3) CopApprox <- GetApprox(Cop, dim=2) plot(CopApprox) ```