audit.totals.to.OS {elec} | R Documentation |
Converting total vote counts to Over Statements
Description
This utility function takes a collection of total votes from an audit and subtracts the originally reported totals from them to give overstatement errors (i.e., how many votes more than actual a candidate had). I.e., the overstatement error is REPORTED - ACTUAL.
Usage
audit.totals.to.OS(Z, audit)
Arguments
Z |
Elec.data object holding the originally reported results |
audit |
A data.frame with one column per candidate that holds the totals from the audit. Each row corresponds to a precinct. Object needs a PID column with precinct ids that match the ones in Z. |
Details
Make sure the audit's PID column is a character vector and not a factor. If
needed, convert via audit\$PID = as.character(audit\$PID)
.
Value
A new data.frame with overstatement errors.
Author(s)
Luke W. Miratrix
See Also
See AuditErrors for different ways of summarizing audit errors.
Examples
## Generate a fake race, a fake audit, and then compute overstatements
Z = make.sample(0.08, 150, per.winner=0.4, R=2.01)
Z
Zb = make.ok.truth(Z, num.off=150, amount.off=5)
Zb
aud = Zb$V[ sample(1:Zb$N, 10), ]
aud
audit.totals.to.OS(Z, aud )