make.sample and friends

Description

These methods are for SIMULATION STUDIES. These functions will build a sample, i.e. simulated, record of votes given certain parameters.

Usage

1
2
3
4
5
6
7
make.cartoon(n = 400, vote.dist = c(125, 113, 13),
             stratify = TRUE)
make.sample(M, N, strata = 1, per.winner = NULL,
                 worst.e.max = NULL, R = NULL,
                 tot.votes = 1e+05)
make.sample.from.totals(vote.W, vote.L, totals)
make.sample.from.totals.margin(M, totals, per.winner = NULL)

Arguments

M

The margin desired between the winner and loser (as a percent).

N

Number of precincts desired.

strata

Number of strata desired.

per.winner

The percent of votes the winner should receive.

worst.e.max

The worst e.max possible for any precinct.

R

The "dispersion" a measure of how unequal in size precincts should be. R needs to be greater than 0. NULL indicates equal size. For R between 0 and 1, the precincts are distributed 'linearly', i.e., the size of precinct i is proportional to i. At 2, the smallest precint will be near 0 and the largest twice the average votes per precinct. After 2, the precincts are distributed in a more curved fashion so that the smaller precincts do not go negative.

tot.votes

The total votes desired.

vote.W

Total votes for winner.

vote.L

Total votes for loser.

totals

Vector of total votes for precincts.

vote.dist

reported votes for C1, C2, and C3 in order for all precincts.prompt

n

Size of sample.

stratify

Should the sample be stratified?

Details

make.cartoon() makes the sample scenario described in Stark's CAST paper.

Value

A elec.data object meeting the desired specifications.

Author(s)

Luke W. Miratrix

References

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

See Also

elec.data make.truth do.audit

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
Z = make.sample(0.08, 150, per.winner=0.4)
Z

Z2 = make.sample(0.08, 150, per.winner=0.4, R=2.2)
Z2

## Note how they have different precinct sizes.

summary(Z$V$tot.votes)
summary(Z2$V$tot.votes)

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.