vb_discrete {blocs}R Documentation

Discrete voting bloc analysis

Description

Define voting blocs along a discrete variable and estimate their partisan vote contributions.

Usage

vb_discrete(
  data,
  data_density = data,
  data_turnout = data,
  data_vote = data,
  indep,
  dv_vote3,
  dv_turnout,
  weight = NULL,
  boot_iters = FALSE,
  verbose = FALSE,
  check_discrete = TRUE
)

Arguments

data

default data.frame to use as the source for density, turnout, and vote choice data.

data_density

data.frame of blocs' composition/density data. Must include any columns named by indep and weight.

data_turnout

data.frame of blocs' turnout data. Must include any columns named by dv_turnout, indep and weight.

data_vote

data.frame of blocs' vote choice data. Must include any columns named by dv_vote3, indep, and weight.

indep

string, column name of the independent variable defining discrete voting blocs.

dv_vote3

string, column name of the dependent variable in data_vote, coded as follows: -1 for Democrat vote choice, 0 for third-party vote, 1 for Republican vote choice, and NA for no vote.

dv_turnout

string, column name of the dependent variable flagging voter turnout in data_turnout. That column must be coded 0 = no vote, 1 = voted.

weight

optional string naming the column of sample weights.

boot_iters

integer, number of bootstrap iterations for uncertainty estimation. The default FALSE is equivalent to 0 and does not estimate uncertainty.

verbose

logical, whether to print iteration number.

check_discrete

logical, whether to check if indep is a discrete variable.

Value

A vbdf object.


[Package blocs version 0.1.1 Index]