Package 'spikes'

Title: Detecting Election Fraud from Irregularities in Vote-Share Distributions
Description: Applies re-sampled kernel density method to detect vote fraud. It estimates the proportion of coarse vote-shares in the observed data relative to the null hypothesis of no fraud.
Authors: Arturas Rozenas
Maintainer: Arturas Rozenas <[email protected]>
License: GPL (>= 2)
Version: 1.1
Built: 2024-11-22 06:53:58 UTC
Source: CRAN

Help Index


Credible interval

Description

Estimates credible interval by (1) taking a draw from the posterior density (2) implementing the RKD step. The procedure is repeated boot times.

Usage

confInt(object, boots = 100)

Arguments

object

object of class out returned by spikes

boots

number of samples from the posterior; defaul 100


Example data

Description

Synthetic dataset

Usage

data("data")

Format

Precinct-level election data from the 2011 Canadian parliamentary elections..

N

number of registered voters

t

turnout

v

votes for the Conservative party

Examples

data(data)

Ouput object

Description

An object of class out returned by spikes or confint.out.

Usage

data("output")

Examples

data(output)
plot(output)

Plots output of spikes

Description

Plots the observed kernel density of data and the upper envelope of the resampled densities.

Usage

## S3 method for class 'out'
plot(x, main = NULL, ...)

Arguments

x

Object of class out

main

Title, NULL by default

...

additional plotting arguments

Examples

data(output)
plot(output)

Fraud-detection from vote-share data

Description

Implements the resampled kernel density method to detect the excess number of election results with coarse vote-shares (a coarse vote-share is a fraction with a low denominator).

Usage

spikes(data, resamples = 1000, bw = 1e-04, grid = 1001, out = NULL)

Arguments

data

Data frame with three columns with names NN (number of votes), tt (number who turned out to vote), and vv (number who voted for the party the votes of which are being analyzed). Returns error if columns are named incorrectly.

resamples

Number of resamples; default 1000

bw

Bandwidth for kernel density; default 0.0001

grid

Number of points on which the density is estimated; default 1001

out

Object containing parameters of beta-mixture model. If spikes has been called earlier, then out = output$out will skip density estimation and proceed directly to resampling.

Value

spikes returns object of class out.

fraud

Estimated percentage of polling stations with fraud.

ymax

Upper envelope of kernel density samples.

w

Weights for each bin: the proportion of observations falling into a bin.

out

Maximum likelihood estimates of the mixture beta binomial parameters for turnout and votes.

data

Data used in estimation.

See Also

See Also plot.out, summary.out

Examples

data(data)
## Not run: 
out <- spikes(data, resamples = 1000)

## End(Not run)

Internal functions

Description

Internal functions, should not be called by user


Summarize

Description

Extracts estimate of fraud and 95 percent credible interval (if such is estimated) for the object of class out returned by spikes or confint.out.

Usage

## S3 method for class 'out'
summary(object, ...)

Arguments

object

Object of class out

...

additional arguments

Note

If the argument is from spikes, then summary returns degenerate credible interval, as it was not estimated. To return a proper credible interval, confint.out must take as its argument object returned by confint.out.

Examples

data(output)
summary(output)