LEGACY CONTENT. If you are looking for Voteview.com, PLEASE CLICK HERE

This site is an archived version of Voteview.com archived from University of Georgia on May 23, 2017. This point-in-time capture includes all files publicly linked on Voteview.com at that time. We provide access to this content as a service to ensure that past users of Voteview.com have access to historical files. This content will remain online until at least January 1st, 2018. UCLA provides no warranty or guarantee of access to these files.

OC in R Software and Examples

Royce Carroll, Jeff Lewis, James Lo, Keith Poole, and Howard Rosenthal

Updated 2 November 2012 (Under Construction)



Download oc:Optimal Classification Roll Call Analysis Software for R

Vignettes of package optimal classification -- From the R Package (PDF). Explains the package and shows examples.


oc_in_R_2010.r -- R program that runs Optimal Classification on the 111th Senate -- S111_DEC_18B.ORD, and writes the legislator and roll call coordinates to disk. Makes a plot of the legislators and a plot of the Coombs Mesh. Program uses Simon Jackman's pscl package function READKH(..) to read the roll call file.

oc_111_RC_679.r -- R program that runs Optimal Classification, writes the legislator and roll call coordinates to disk, and makes a two panel plot showing a roll call vote. The first plot shows how the legislators voted (red for YEA, blue for NAY), and the second plot shows only the errors. Program uses s111_dec_18b.ORD.

oc_annenberg_2.r -- R program that reads a text file, puts file through "rollcall" in pscl, runs Optimal Classification, writes the legislator and roll call coordinates to disk, and makes a two panel plot showing a roll call vote. The first plot shows how the legislators voted (red for YEA, blue for NAY), and the second plot shows only the errors. Program uses the text file Annenberg_Panel_2.dat.

oc_example_tabs.r -- R program that reads a tab deliminated file (that has been entered transposed -- the roll calls are rows), puts file through "rollcall" in pscl, runs Optimal Classification, writes the legislator and roll call coordinates to disk, and makes a two panel plot showing the "legislators" and the "roll calls" with arrows on the cutting lines indicated the direction of a YEA vote. The plots also illustrate the placement of two or more letter tokens with control over the positioning of the tokens. Program uses the tab delimited file Example_Tabs.txt.

oc_in_R_H112_animation.r -- R program that reads a roll call file in ORD format, puts file through "rollcall" in pscl, runs Optimal Classification, writes the legislator and roll call coordinates to disk, and makes a two panel plot showing the Legislators and the Coombs Mesh, and then writes jpegs to disk of the cutting lines. These jpegs can then be used in any animation program to produce an animation of the Coombs Mesh being filled in. An example is shown on The Voteview Blog -- namely, this post on the early 112th House. Program uses the file HOU112KH.ORD.

oc_in_R_2011_test.r -- R program that reads an ORD file, "rollcall" in pscl, runs Optimal Classification, writes the legislator and roll call coordinates to disk, and makes a two panel plot showing the legislators and the roll calls with arrows on the cutting lines indicated the direction of a YEA vote. The Program uses the file SEN112KH.ORD.

oc_wnom_in_R_2010.r -- R program that reads an ORD file, "rollcall" in pscl, runs Optimal Classification, writes the legislator and roll call coordinates to disk, and makes a two panel plot showing the "legislators" and the "roll calls" with arrows on the cutting lines indicated the direction of a YEA vote. The program then runs W-NOMINATE (see the W-NOMINATE in R Examples Page). Program writes the roll call and legislator coordinates out in fixed record format and shows simple commands to count the constrained roll calls. Program uses the file SEN500.ORD.

oc_text_files.r -- R program that reads a text file using the function read.txt <- function(rc.file) {.....}, passes the matrix to "rollcall" in pscl, and runs Optimal Classification. Program also includes the function votetotals <- function(rcdta,minminority=0.025) {...} that checks for roll calls with a pre-set minimum number of legislators in the minority. Program uses the file AZ_2001.TXT.



To see how OC works in one dimension, go to this page:

How Optimal Classification Works in One Dimension

To see how OC works in two or more dimensions, go to this page:

How Optimal Classification Works in Two or More Dimensions (Under Construction)




Site Links

VOTEVIEW Blog
NOMINATE Data, Roll Call Data, and Software
Course Web Pages: University of Georgia (2010 - )
Course Web Pages: UC San Diego (2004 - 2010)
University of San Diego Law School (2005)
Course Web Pages: University of Houston (2000 - 2005)
Course Web Pages: Carnegie-Mellon University (1997 - 2000)
Analyzing Spatial Models of Choice and Judgment with R
Spatial Models of Parliamentary Voting
Recent Working Papers
Analyses of Recent Politics
About This Website
K7MOA Log Books: 1960 - 2017
Bio of Keith T. Poole
Related Links