Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

computeMargins

add information about voting outcomes to a rollcall object


Description

Add summaries of each roll call vote to a rollcall object.

Usage

computeMargins(object, dropList = NULL)

Arguments

object

an object of class rollcall

dropList

a list (or alist) listing voting decisions, legislators and/or votes to be dropped from the analysis; see dropRollCall for details.

Details

The subsetting implied by the dropList is first applied to the rollcall object, via dropRollCall. Then, for each remaining roll call vote, the number of legislators voting “Yea”, “Nay”, and not voting are computed, using the encoding information in the codes component of the rollcall object via the convertCodes function. The matrix of vote counts are added to the rollcall object as a component voteMargins.

Value

An object of class rollcall, with a component voteMargins that is a matrix with four columns:

Yea

number of legislators voting “Yea”

Nay

number of legislators voting “Nay”

NA

number of legislators not voting “Nay”

Min

the number of legislators voting on the losing side of the roll call

Author(s)

See Also

dropRollCall on specifying a dropList. The vote-specific marginals produced by this function are used by as dropRollCall, summary.ideal and predict.ideal.

Examples

data(s109)
tmp <- computeMargins(s109)
dim(tmp$voteMargins)   ## 645 by 4

tmp <- computeMargins(s109,
                     dropList=list(codes="notInLegis",lop=0))
dim(tmp$voteMargins)   ## 544 by 4

pscl

Political Science Computational Laboratory

v1.5.5
GPL-2
Authors
Simon Jackman, with contributions from Alex Tahk, Achim Zeileis, Christina Maimone, Jim Fearon and Zoe Meers
Initial release
2020-02-25

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.