The algorithm proceeds in two steps.
the equality constraints \(Ex=F\) are eliminated, and the
system \(Ex=f\), \(Gx>=h\) is rewritten as \(G(p+Zq)>= h\),
i.e. containing only inequality constraints and where Z is a basis for
the null space of E.
the distribution of \(q\) is sampled numerically
using a random walk (based on the Metropolis algorithm).
There are three algorithms for selecting new samples: rda,
cda (two hit-and-run algorithms) and a novel mirror algorithm.
In the rda algorithm first a random direction is selected,
and the new sample obtained by uniformly sampling the line
connecting the old sample and the intersection with the planes defined
by the inequality constraints.
the cda algorithm is similar, except that the direction is
chosen along one of the coordinate axes.
the mirror algorithm is yet unpublished; it uses the
inequality constraints as "reflecting planes" along which jumps are
reflected.
In contrast to cda and rda, this algorithm also works
with unbounded problems (i.e. for which some of the unknowns can attain
Inf).
For more information, see the package vignette vignette(xsample) or
the file xsample.pdf in the packages docs subdirectory.
Raftery and Lewis (1996) suggest a minimum of 3000 iterations to reach
the extremes.
If provided, then x0 should be a valid particular solution (i.e.
\(E*x0=b\) and \(G*x0>=h\)), else the algorithm will fail.
For larger problems, a central solution may be necessary as a starting
point for the rda and cda algorithms. A good starting
value is provided by the "central" value when running the function
xranges with option central equal to TRUE.
If the particular solution (x0) is not provided, then the
parsimonious solution is sought, see ldei.
This may however not be the most efficient way to start the algorithm. The
parsimonious solution is usually located near the edges, and the
rda and cda algorithms may not get out of this corner.
The mirror algorithm is insensitive to that. Here it may be even
better to start in a corner (as this position will always never be
reached by random sampling).
The algorithm will fail if there are hidden equalities. For instance, two
inequalities may together impose an equality on an unknown,
or, inequalities may impose equalities on a linear combination of two or
more unknowns.
In this case, the basis of the null space Z will be deficient. Therefore,
xsample starts by checking if such hidden equalities exist.
If it is suspected that this is NOT the case, set test to
FALSE. This will speed up execution slightly.
It is our experience that for small problems either the rda and
cda algorithms are often more efficient.
For really large problems, the mirror algorithm is usually much more
efficient; select a jump length (jmp) that ensures good random
coverage, while still keeping the number of reflections reasonable.
If unsure about the size of jmp, the default will do.
See E_coli for an example where a relatively large problem
is sampled.