# sim.race: Simulate CAST audits to assess performance In elec: Collection of functions for statistical election audits

## Description

Simulate a race (using the `make.cartoon` method) and run a CAST audit on that simulation. CAST is a system devised by Dr. Philip B., Stark, UC Berkeley Department of Statistics.

## Usage

 ```1 2 3``` ```sim.race(n = 800, beta = 0.75, stages = 2, truth.maker = make.truth.opt.bad, print.trail = FALSE) ```

## Arguments

 `beta` the confidence level desired `stages` number of auditing stages. Each stage will have the same confidence level, determined by a function of beta. `print.trail` Print out diagnostics. `n` Desired sample size. `truth.maker` Function to generate "truth"

## Value

A vector of 3 numbers. The first is the stage reached. The second is the total number of precincts audited. The third is 0 if the audit failed to certify (i.e. found large error in the final stage), and 1 if the audit certified the election (did not find large error in the final stage).

Luke W. Miratrix

## References

See http://www.stat.berkeley.edu/~stark/Vote/index.htm for relevant information.

See `CAST` and `CAST.calc.opt.cut` for methods regarding CAST audits. Also see `do.audit`, `make.sample`, and `make.truth` for doing other simulation studies of this method.
 ```1 2 3 4 5 6``` ``` ## See how many times the CAST method fails to catch a wrong ## election in 20 trials. replicate( 20, sim.race( beta=0.75, stages=2, truth.maker=make.truth.opt.bad) ) ## Now see how much work the CAST method does for typical elections. replicate( 20, sim.race( beta=0.75, stages=2, truth.maker=make.ok.truth) ) ```