Skip to content

Instantly share code, notes, and snippets.

@drewconway
Created November 17, 2009 17:57
Show Gist options
  • Save drewconway/237101 to your computer and use it in GitHub Desktop.
Save drewconway/237101 to your computer and use it in GitHub Desktop.
# File-Name: cpi_oprobit.R
# Date: 2009-11-17
# Author: Drew Conway
# Purpose: Quick ordered probit analysis of the Corruption Perceptions Index 2009
# to check for effect of number of surveys used on CPI scores
# Data Used: corruption_index.csv
# available here: http://www.drewconway.com/zia/wp-content/uploads/2009/11/corruption_index.csv
# Packages Used: foreign,Zelig
# Output File:
# Data Output:
# Machine: Drew Conway's MacBook
library(foreign)
library(Zelig)
#Get data
cpi<-read.csv('corruption_index.csv')
# Run ordered-probit, CPI scores are rounded so the dep vars are discrete integers
cpi.op<-zelig(as.factor(round(CPI.2009.Score))~Surveys.Used,data=cpi,model="oprobit")
# Get results
summary(cpi.op)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment