stark.test {elec} | R Documentation |
These main methods conduct the test of the election audit and returns a p-value and other related info on that test.
It is an older method. Most likely CAST.audit
or
trinomial.audit
should be used instead.
stark.test(votes, audits, C.names = NULL, f = 1, pool = TRUE, pairwise = FALSE, ...) stark.test.Z(Z, calc.e_p = calc.pairwise.e_p, w_p = weight.function("no.weight"), max_err = maximumMarginBound, bound.col = Z$tot.votes.col, strat.col = NULL, drop = NULL, strat.method = NULL, err.override = NULL, n = NULL, t = NULL, q = NULL) stark.pairwise.test(votes, audits, C.names = NULL, f = 1, pool = TRUE, ...)
votes |
data.frame of votes. Each row is precinct. |
audits |
data.frame of audits. Each row is precinct. Table reports overstatement by candidate. |
C.names |
Names of candidates (and names of cor columns in votes and audits tables. If NULL will derive from cols 2 on of votes |
f |
The number of winners |
pool |
|
pairwise |
if TRUE then do a pairwise test for all pairs and return highest p-value |
Z |
The object holding all the voting information. See below for details. |
calc.e_p |
The Function used to calculate maximum error bounds |
w_p |
The function used to calculate weights of error (A list of two functions) |
max_err |
Function to compute max error bounds for each precint |
bound.col |
|
strat.col |
Name of column that determines how to stratify if NULL will not stratify |
strat.method |
|
err.override |
|
n |
Elements of the test statistic. Can pass to avoid computation if those values are already known (e.g., for a simulation) |
t |
Elements of the test statistic. Can pass to avoid computation if those values are already known (e.g., for a simulation) |
q |
Elements of the test statistic. Can pass to avoid computation if those values are already known (e.g., for a simulation) |
drop |
Either a vector of TRUE/FALSE or a name of a column in Z$V of T/F values. Precincts identified by drop will be dropped from calculations. |
... |
Extra arguments passed directly to the work-horse method stark.test.Z |
stark.test() will do the entire test. It is basically a driver function that sets up 'Z' matrix and passes buck to the stark.test.Z
The Z object, in particular has: Z$V: The table of reported votes Z$audit: The table of audits as differences from recorded votes
Return an htest object with pvalue, some relevant statistics, and the Z object used (possibly constructed) that produced those results.
Luke W. Miratrix
See elec.data
for description of the main object. See
find.q
and compute.stark.t
for the main
components of this test. find.stark.SRS.p
is a
utility function for computing a p-value for a specific
situation. See weight.function for functions used to
weight audit errors. See MaximumBounds for different
bounds on error that one might use for these tests. See find.stratification
for a utility for stratification.
## pretending that santa cruz audit was a SRS audit (which it was not) data(santa.cruz) Z = elec.data(santa.cruz, C.names=c("leopold","danner")) data(santa.cruz.audit) ## do some work to get the audit totals to overstatements rownames(santa.cruz.audit) = santa.cruz.audit$PID Z$audit = audit.totals.to.OS(Z, santa.cruz.audit) Z$audit stark.test.Z(Z)