Description Usage Arguments Value Author(s) See Also Examples

This is a SIMULATION FUNCTION, and is not used for actual auditing of elections.

Given a matrix of votes, calculate the weights for all precincts and then draw a sample (using tri.sample). Then, assuming that p\_d percent of the precincts (at random) have error, and the errors are due to vote miscounts of size 'swing', conduct a simulated “audit”, returning the found descrepancies.

1 2 3 | ```
tri.audit.sim(Z, n, p_d = 0.1, swing = 5,
return.type = c("statistics", "taints", "precinct"),
seed = NULL, PID = "PID", ...)
``` |

`Z` |
elec.data object. |

`n` |
Sample size to draw. |

`p_d` |
The probability of a precinct having an error. |

`swing` |
The size of the error, in votes. |

`return.type` |
What kind of results to return: "statistics","taints", or "precinct" |

`seed` |
Random seed to use. |

`PID` |
Column name of column holding unique precinct IDs |

`...` |
Extra arguments passed to tri.sample |

List of taints found in such a circumstance OR precincts selected with relevant attributes (including simulated errors, if asked) OR the number of non-zero taints and the size of largest taint.

Luke W. Miratrix

`elec.data`

for the object that holds vote data. See
`tri.calc.sample`

for computing sample sizes for trinomial
bound audits.

1 2 3 4 5 6 7 8 9 10 | ```
data(santa.cruz)
Z = elec.data(santa.cruz, C.names=c("leopold","danner"))
Z$V$e.max = maximumMarginBound( Z )
## Sample from fake truth, see how many errors we get.
tri.audit.sim( Z, 10, p_d=0.25, swing=10, return.type="precinct" )
## what does distribution look like?
res = replicate( 200, tri.audit.sim( Z, 10, p_d=0.25, swing=10 ) )
apply(res,1, summary)
hist( res[2,], main="Distribution of maximum size taint" )
``` |

elec documentation built on May 30, 2017, 5:51 a.m.

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.