get.first.r.samp: Obtain a Vector of Sample Sizes Given Constraint on p-Value

Description Usage Arguments Details Author(s) References See Also Examples

View source: R/optStrat.R

Description

get.first.r.samp, get.next.r.samp, and get.prop.samp obtain sample sizes so that, if a maximum observed overstatement of t or less is observed, the sample will produce a p-value less than alpha.

get.first.r.samp uses the first.r algorithm to obtain the sample, get.next.r.samp uses the next.r algorithm to obtain the sample, and get.prop.samp finds a vector of sample sizes that is proportional to stratum sizes.

For details about the first.r and the next.r algorithms, and for a description on how to produce a sample that will ensure that the p-value is less than alpha when no overstatement greater than t is uncovered, see Higgins, Rivest, Stark.

Usage

1
2
3
4
5
6
7
8
9
	get.first.r.samp(Z, alpha, t, bal=TRUE, numSamp = TRUE, initn = 1, 
		asTaint = FALSE, asNumber = FALSE, M = NULL, 
		takeOutZeroMMB=TRUE)
	get.next.r.samp(Z, alpha, t, bal=TRUE, numSamp = TRUE, initn = 1, 
		asTaint = FALSE, asNumber = FALSE, M = NULL, 
		takeOutZeroMMB=TRUE)
	get.prop.samp(Z, alpha, t, bal=TRUE, numSamp = TRUE, initn = 1, 
		asTaint = FALSE, asNumber = FALSE, M = NULL, 
		takeOutZeroMMB=TRUE)

Arguments

Z

A strat.elec.data object.

t

Value of the observed maximum, either as the MRO, as taint, or as the overstatement of the margin in votes.

alpha

Threshold for the p-value. If an audit does not uncover an overstatement less than t, the sample obtained will ensure that the p-value is less than alpha.

bal

If bal = TRUE, the output will include the expected number of audited ballots for the sample.

numSamp

If numSamp = TRUE, the output will include the total number of audited batches.

initn

The first sample size checked by algorithm will have a total of initn samples. If this first sample will not produce a p-value less than alpha, the algorithm will increment the number of samples until such a vector of sample sizes is found. initn may be adjusted to dramatically decrease the runtime of algorithms.

asTaint

Set asTaint = TRUE if t is the maximum observed taint.

asNumber

Set asNumber if t is the maximum observed overstatement of the margin in votes.

M

A priori margin. If NULL, M defaults to 1.

takeOutZeroMMB

Setting takeOutZeroMMB = TRUE will consider batches with a maximumMarginBound of zero as having no chance of being sampled.

Details

Sample sizes from get.first.r.samp and get.next.r.samp are obtained by repeatedly calling first.r and next.r, respectively, while incrementing the total number of samples n. The algorithm stops when the sample produced will ensure a p-value less than alpha.

Author(s)

Mike Higgins

References

M. Higgins, R. L. Rivest, P. B. Stark. Sharper p-Values for Stratified Election Audits

See Also

See first.r, next.r and propSizes for finding sample sizes given constraints on the p-value and the largest observed overstatement. Also, see first.r and next.r for a brief description of the first.r and next.r algorithms. See optStrat for finding optimal sample sizes so that, if a maximum observed overstatement of t or less is observed, the sample will produce a p-value less than alpha. Optimal sample sizes will minimize the number of batches required for audit.

Examples

1
2
3
4
	data(CA_House_2008)
	get.first.r.samp(CA_House_2008.strat[[3]], alpha = .1, t = .01, asTaint = TRUE)
	get.next.r.samp(CA_House_2008.strat[[3]], alpha = .1, t = .01, asTaint = TRUE)
	get.prop.samp(CA_House_2008.strat[[3]], alpha = .1, t = .01, asTaint = TRUE)

elec.strat documentation built on May 1, 2019, 8:39 p.m.