Learn R Programming

elec (version 0.1.2.2)

make.random.truth: making fake truth for electios

Description

Make a random truth that is with the reported outcome, but has random error scattered throughout.

Usage

make.random.truth(
  Z,
  p_d = 0.1,
  swing = 10,
  uniform = TRUE,
  seed = NULL,
  PID = "PID"
)

Arguments

Z

elec.data object. The original reported results.

p_d

chance a batch has error

swing

max amount of error in votes.

uniform

if yes, then error is from 1 to swing. If no, then error is swing.

seed

random seed to ease replication

PID

which column has batch IDs.

Value

# Return: elec.data object holding the 'truth'.

Details

Given reported results (Z), make a new data.frame which is the truth (that can be 'audited' by looking at relevant precincts).

This is the generic small error generation used in trinomial paper and elsewhere as a baseline "normal" mode of operations.