View source: R/S_array_from_inequalities_and_conditions.R
S_array_from_inequalities_and_conditions | R Documentation |
The SimplicialCubature::adaptIntegrateSimplex()
function requires an array
of vertices S
over which to integrate. This function produces
this array from
a matrix of inequalities and optional arguments specifiying alterations to
these inequalities.
S_array_from_inequalities_and_conditions(
inequality_mat,
rows_to_alter = c(NULL),
drop_dimension = F,
limits = c(0, NULL),
epsilon = 1e-10,
qhull_options = NULL
)
inequality_mat |
An R x C+1 matrix. Each row is an inequality of the
form Ax > b. The coefficients A come from the first C columns,
the constant b comes from the last column, and the x's are (in this case)
the shares of each ballot. For example, if there were only two ballots
and the sole condition is |
rows_to_alter |
The indices of any rows in |
drop_dimension |
If |
limits |
Determine the range within which the inequality
in |
epsilon |
Tolerance for determining which vertices of the convex hull
defined by |
qhull_options |
These are passed to |
For estimating pivot event probabilities, the general procedure is to specify
a matrix of conditions under which a given candidates wins
(inequality_mat
) and
then specify which of these conditions (rows_to_alter
) should
be met with near equality (drop_dimension=F
) or
exact equality (drop_dimension=T
). The function could be used for
other purposes, however.
An array of matrices, each representing one simplex. Note that each *column* of each matrix is one vertex. (You might expect rows to indicate vertices.)
# plurality conditions with 3 candidates
n <- 1000
inequality_mat <- rbind(c(1,-1,0,1/n),
c(1,0,-1,1/n))
# simplices covering region where candidate 1 wins
S_array_from_inequalities_and_conditions(inequality_mat)
# simplices covering region where candidate 1 finishes just ahead of candidate 2
S_array_from_inequalities_and_conditions(inequality_mat,
rows_to_alter = c(1), limits = c(0, 1/n))
# simplices covering facet where candidates 1 and 2 tie
S_array_from_inequalities_and_conditions(inequality_mat,
rows_to_alter = c(1), drop_dimension = T, limits = c(0, 1/n))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.