Bayesian Ideal Points Estimation

Packages you’ll need

  • First of all, make sure you’ve a working C++ compiler in your machine; you’ll need it for Stan/rstan to work.
# devtools::install_github("dmarcelino/SenadoBR")
# devtools::install_github("rmcelreath/rethinking")
library(readr) # pacakge for reading data 
library(rstan) # package for interacting with Stan (sampling over distributions) 
# library(rethinking) # package for interacting with Stan
library(ggplot2) # package for plotting 

Introduction

This tutorial will use data from the brazilian Senate, and build a comparison between two approaches very widespread in the political science studies. Namely, the

y_{ij} = x_i - _j,

where yij is our data matrix of observed votes (1=yes, 0=no, absent); xi are the legislator ideal points, and βj and αj are the discrimination and difficulty parameters, respectively (slope and intercept). See Clinton, Jackman & Rivers (2004) for more details.

First, we’ll load the packages and import the data from my github repo using read_csv, which is roll-call data from the 53rd legislature of the Brazilian Federal Senate.

The data

First, we’ll load the packages and import the data from my github repo using read_csv, which is roll-call data from the 53rd legislature of the Brazilian Federal Senate.