# tri.calc.sample: Calculate needed sample size for election auditing using the... In elec: Collection of functions for statistical election audits

## Description

Calculate an estimated sample size to do a trinomial bound that would have a specified power (the chance to certify assuming a given estimate of low-error error rate), and a specified maximum risk of erroneously certifying if the actual election outcome is wrong.

## Usage

 ```1 2 3``` ```tri.calc.sample(Z, beta = 0.75, guess.N = 20, p_d = 0.1, swing = 5, power = 0.9, bound = c("e.plus", "WPM", "passed")) ```

## Arguments

 `Z` elec.data object `beta` 1-beta is the acceptable risk of failing to notice that a full manual count is needed given an election with an actual outcome different from the semi-official outcome. `guess.N` The guessed needed sample size. `p_d` For the alternate: estimate of the proportion of precincts that have error. `swing` For the alternate: estimate of the max size of an error in votes, given that error exists. `power` The desired power of the test against the specified alternate defined by p\_d and swing. `bound` e.plus, WPM, or use the passed, previously computed, e.max values in the Z object.

## Value

An `audit.plan.tri` object. This is an object that holds information on how many samples are needed in the audit, the maximum amount of potential overstatement in the election, and a few other things.

Luke W. Miratrix

## References

See Luke W. Miratrix and Philip B. Stark. (2009) Election Audits using a Trinomial Bound. http://www.stat.berkeley.edu/~stark

See `elec.data` for information on the object that holds vote counts. See `tri.sample` for drawing the actual sample. See `audit.plan.tri` for theo object that holds the audit plan information (e.g., number of draws, estimated work in ballots to audit, etc.). See `trinomial.bound` for analyzing the data once the audit results are in. See `tri.audit.sim` for simulating audits using this method. See CAST for an SRS audit method.
 ```1 2 3 4``` ```data(santa.cruz) Z = elec.data( santa.cruz, C.names=c("danner","leopold") ) tri.calc.sample( Z, beta=0.75, guess.N = 10, p_d = 0.05, swing=10, power=0.9, bound="e.plus" ) ```