hyperdirichlet (version 1.5-1)

e_to_p: Transform from a simplex to a hypercube

Description

Transform from a simplex (either regular or right-angled) to a hypercube.

Usage

e_to_p(e)
p_to_e(p)
Jacobian(e)

Arguments

e
Vector with all elements between 0 and 1 (hypercube)
p
Vector of positive elements whose sum is either equal to, or less than, one (simplex)

Value

The functions documented here return a scalar.

Details

Function e_to_p() takes one from e-space to p-space.

Function p_to_e() takes one from p-space to e-space. This is useful when integrating over a simplex; use Jacobian() to evaluate the Jacobian of the transform.

Forward transformation:

$$e_1=\sum_{i=1}^d p_i$$

$$e_i=\frac{p_{i-1}}{\sum_{j=i-1}^d p_j},\qquad 2\leq i <= d$$

Backward transformation:

$$p_1=e_1 e_2$$

$$p_i=e_1e_{i+1}\prod_{i=2}^{i}\left(1-e_i\right),\qquad 2\leq i\leq d$$

Jacobian:

$$J=\prod_{i=2}^{d-1}\left(1-e_i\right)^{d-i}$$

References

  • M. Evans and T. Swartz 2000. Approximating Integrals via Monte Carlo and Deterministic Methods, Oxford University Press; page 28
  • Robin K. S. Hankin (2010). “A Generalization of the Dirichlet Distribution”, Journal of Statistical Software, 33(11), 1-18, http://www.jstatsoft.org/v33/i11/

See Also

dhyperdirichlet

Examples

Run this code

## Not run: ------------------------------------
# # First, try to calculate the volume of a regular 4-simplex:
# adapt(5,rep(0,5),rep(1,5),functn=function(x){Jacobian(c(1,x))})
# # Should be close to 1/5! = 1/120 ~= 0.008333
# # (that was the 'di trick')
# 
# # Now, try to calculate the volume of a triangular-based pyramid:
# adapt(3,rep(0,3),rep(1,3),functn=Jacobian)
# # Should be close to 1/8=0.125
## ---------------------------------------------


Run the code above in your browser using DataCamp Workspace