# Joint Range of a Set of Expections in R

The `rcdd` package for R (see main page for this site for how to get it) has functions for going between H-representation (solution set of a finite set of linear equalities and inequalities, intersection of a finite set of closed half spaces) and V-representation (convex hull of a finite set of vertices) of a convex polyhedron.

We use this to calculate imprecise probabilities as follows.

In 10-dimensional Euclidean space we consider the set of prior probability vectors (on a finite parameter space of 10 points) determined by two equality and two inequality constraints.

The equalities were p5 = p6 and ∑i ipi = 5.5.

The inequalities were p1p2 and p1 + p2 + p3 + p4 ≤ 0.5.

We had two linear functions of interest. We let ψ1 be the variance function defined by ψ1(i) = (i-5.5)2 and let ψ2 be the indicator function of the set {2, 3, 4, 5}.

When doing the posterior calculations we assumed that the probabilities of seeing the observed data under the 10 possible parameter values were 0.1, 0.15, 0.09, 0.2, 0.3, 0.2, 0.1, 0.05, 0.07 and 0.02.

The code in the following box calculates a matrix `qux` that represents this convex polyhedron of priors as defined by the constraints (H-representation) and then converts it to a matrix `vert`, the rows of which are the vertices (V-representation). It then maps the polyhedron to its image under the map with coordinates ψ1 and ψ2 and calculate the vertices and convex hull of the image polygon.

You can edit this box to change the numbers and re-submit to do a different analysis.

The code in the following box repeats some of the previous box (necessary because Rweb has no memory, the repetition would be unnecessary in R).

Then we calculate the family of posterior distributions corresponding to the family of prior distributions using Bayes rule (using the likelihood given above). The vertices of this family are a subset of the rows of the matrix `post`. We then calculate a picture just like the one in the preceding box but for the posterior family instead of the prior family.