optStrat
will obtain sample sizes so that,
if a maximum observed overstatement
of t
or less is observed, the sample will produce a pvalue
less than alpha
.
The sample that optStrat
obtains minimizes the total number of
batches required for audit.
optStrat
includes options so that, given the number of samples
required for audit for optimal sample sizes,
the sample that minimizes the expected number of audited ballots is found.
optStrat
can be a very computationally expensive function, and
should only be used for small contests.
1 2 
Z 
A 
t 
Value of the observed maximum, either as the MRO, as taint, or as the overstatement of the margin in votes. 
alpha 
Threshold for the pvalue.
If an audit does not uncover an overstatement less than 
bal 
If 
optBal 
If 
numSamp 
If 
asTaint 
Set 
asNumber 
Set 
M 
A priori margin. If NULL, 
takeOutZeroMMB 
Setting 
Mike Higgins
See get.first.r.samp, get.next.r.samp
,
and get.prop.samp
for other methods to obtain sample sizes so that,
if a maximum observed overstatement
of t
or less is observed, the sample will produce a pvalue
less than alpha
.
get.first.r.samp
uses the first.r
algorithm to obtain the sample,
get.next.r.samp
uses the next.r
algorithm to obtain the sample,
and get.prop.samp
finds a vector of sample sizes that is proportional
to stratum sizes.
1 2 3 4  data(CA_House_2008)
optStrat(CA_House_2008.strat[[3]], alpha = .1, t = .01, asTaint = TRUE)
optStrat(CA_House_2008.strat[[3]], alpha = .1, t = .01,
asTaint = TRUE, optBal = TRUE)

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.
Please suggest features or report bugs with the GitHub issue tracker.
All documentation is copyright its authors; we didn't write any of that.