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.


spacer 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.

spacer 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.

spacer 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.

spacer 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.

spacer 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 H112.ORD (Roll Calls through March, 2011).

spacer 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 S112.ORD (Senate Voting as of June 2011).

spacer 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.

spacer oc_text_files.r -- R program that reads a text file using the function read.txt "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:

spacer How Optimal Classification Works in One Dimension

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

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



Site Links

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

gipoco.com is neither affiliated with the authors of this page nor responsible for its contents. This is a safe-cache copy of the original web site.