Skip to contents

This function calculates the roll call errors and the Proportional Reduction in Error (PRE) statistic for a given roll call vote. The function can handle both "nomObject" and "OCobject" classes, typically representing NOMINATE or Optimal Classification results.

Usage

rc.errors(obj, data, rcnum, rotMat = diag(2))

Arguments

obj

An object of class nomObject or OCobject containing the results of a NOMINATE or Optimal Classification analysis.

data

A data frame containing the roll call data, including vote outcomes and codes for "yea" and "nay" votes.

rcnum

An integer specifying the roll call number for which errors and PRE should be calculated.

rotMat

A 2x2 rotation matrix used to rotate the coordinates in the case of an OCobject. The default is the identity matrix.

Value

A list with the following components:

  • tot.errors: A named vector with the total number of "yea" and "nay" errors.

  • PRE: The Proportional Reduction in Error statistic, calculated as the proportion of errors reduced relative to the worst-case scenario.

  • errors: A matrix indicating which legislators made errors in their votes, with columns for "yea" and "nay" errors.

Examples

if (FALSE) { # \dontrun{
data(hr108)
library(wnominate)
result <- wnominate(hr108, ubeta=15, uweights=0.5, dims=2,
minvotes=20, lop=0.025, trials=1, polarity=c(1,5), verbose=FALSE)
rc.errors(result, hr108, 528)[c("tot.errors", "PRE")]
} # }