simplex | R Documentation |
Generation of grid points over the multivariate simplex
simplex(d, n = 50, a = 0, b = 1)
d |
A positive integer indicating the dimension of the simplex. |
n |
A positive integer indicating the number of grid points to be generated on the univariate components of the simplex. |
a , b |
Two numeric values indicating the lower and upper bounds of the simplex. By default |
A d
-dimensional simplex is defined by
S = \{ (\omega_1, \ldots, \omega_d) \in \mathbb{R}^d_+ : \sum_{i=1}^d \omega_i = 1 \}.
Here the function defines the simplex as
S = \{ (\omega_1, \ldots, \omega_d) \in [a,b]^d : \sum_{i=1}^d \omega_i = 1 \}.
When d = 2
and [a,b] = [0,1]
, a grid of points of the form
\{ (\omega_1, \omega_2) \in [0,1] : \omega_1 + \omega_2 = 1 \}
is generated.
Returns a matrix with d
columns.
When d = 2
, the number of rows is n
.
When d > 2
, the number of rows is equal to
\sum_{i_{d-1}=0}^{n-1} \sum_{i_{d-2}=0}^{n-i_{d-1}} \cdots \sum_{i_1=1}^{n-i_{d-1}-\cdots-i_2} i_1.
Simone Padoan, simone.padoan@unibocconi.it, https://faculty.unibocconi.it/simonepadoan/; Boris Beranger, borisberanger@gmail.com, https://www.borisberanger.com;
### 3-dimensional unit simplex
W <- simplex(d = 3, n = 10)
plot(W[,-3], pch = 16)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.