During this week, we will investigate how to measure political ideology with social media data, one of the most important and useful measures in social media research.


Presentations

Marie and Amalie are presenting:
Politicians in the Line of Fire: Incivility and the Treatment of Women on Social Media
Ludovic Rheault, Erica Rayment, and Andreea Musulan (2019)

Elias is presenting:
Concealing Corruption: How Chinese Officials Distort Upward Reporting of Online Grievances
Jennifer Pan and Kaiping Chen (2018)


Readings

I suggest focusing on the first of the three readings below (skimming the second and third). We will implement Pablo Barberá’s measure of ideology in R in the lab. If you have difficulty following the technical parts of his article, that’s perfectly alright, because we’ll walk through that part of it in class.

  1. Birds of the Same Feather Tweet Together: Bayesian Ideal Point Estimation Using Twitter Data
    Political Analysis, 2015
    Pablo Barberá

  2. News Sharing on Social Media: Mapping the Ideology of News Media, Politicians, and the Mass Public
    Working paper, 2024
    Gregory Eady, Richard Bonneau, Joshua A. Tucker, and Jonathan Nagler

  3. Sharing the News in a Polarized Congress: Partisan and Ideological Divides Shape Which News Outlets Legislators Share Links to on Facebook
    PEW Research Center Report, 2017
    Solomon Messing, Patrick van Kessel, and Adam Hughes


Lectures

1. Introduction to political ideology

There is a massive amount of research on methods to measure ideology in political science. In the lecture, I refer to the following articles:

A Spatial Model for Legislative Roll Call Analysis
American Journal of Political Science, 1985
Keith Poole and Howard Rosenthal

Dynamic Ideal Point Estimation via Markov Chain Monte Carlo for the U.S. Supreme Court, 1953-1999
Political Analysis, 2002
Andrew D. Martin and Kevin M. Quinn

A Scaling Model for Estimating Time-Series Party Positions from Texts
American Journal of Political Science, 2008
Jonathan B. Slapin and Sven-Oliver Proksch

Ideology and Interests in the Political Marketplace
American Journal of Political Science, 2013
Adam Bonica

Mapping the Ideological Marketplace
American Journal of Political Science, 2014
Adam Bonica

Democracy as a Latent Variable
American Journal of Political Science, 2008
Shawn Treier and Simon Jackman

Quantifying Social Media’s Political Space: Estimating Ideology from Publicly Revealed Preferences on Facebook
American Political Science Review, 2015
Robert Bond and Solomon Messing

2. Measuring political ideology on Twitter

In the second part of the lecture, I will refer to the following article. The discussion of the use of Twitter follower ideology scores is in the Appendix on page 15-16:

Exposure to Opposing Views Can Increase Political Polarization: Evidence from a Large-Scale Field Experiment on Social Media
Proceedings of the National Academy of Sciences, 2018
Christopher Bail, Lisa Argyle, Taylor Brown, John Bumpus, Haohan Chen, M. B. Fallin Hunzaker, Jaemin Lee, Marcus Mann, Friedolin Merhout, and Alexander Volfovsky

On measurement validity (in this case, “convergent validity”), see:

Measurement Validity: A Shared Standard for Qualitative and Quantitative Research
American Political Science Review, 2001
Robert Adcock and David Collier

I will refer to the following R library in the last section of the lecture regarding measuring ideology with sharing behavior.

The R library for estimating the ideology of users, politicians, and news media organizations can be found here: mediascores library

A vignette for using the library can be found here: vignette


Lab

This lab is a touch long, at 55 minutes, because we’re working with real data here, rather than using a toy problem. Cleaning follower data and fitting a model to those data may be a good candidate for an exam question, so please work through the R code when you watch the lecture. However, as the basis of an applied exam question, I would make the problem somewhat less challenging.

Reference code from the video tutorial: Follower_Ideology.R
Politicians follower data: Politician_Followers_Sample.zip
Politicians data: Politician_IDs_Ideology.rds
Fitted model: model_irt.rds

The academic article on which the models in the emIRT library are based is the following:

Fast Estimation of Ideal Points with Massive Data
American Political Science Review, 2016
Kosuke Imai, James Lo, and Jonathan Olmsted

To install emIRT, you will need to install it from source from the CRAN R archive (this can take a while to install 10+ minutes)


If you are on a Mac, you need to do the following first:

  • Install gfortran-6.1.pkg from here
  • From Terminal, create a directory in your home directory called “.R”. Your home directory is ~/ in Terminal. i.e. mkdir ~/.R
  • Create a file in the ~/.R/ directory called Makevars that contains the following:
    FC = /usr/local/bin/gfortran
    F77 = /usr/local/bin/gfortran
    FLIBS = -L /usr/local/bin/gfortran/lib
  • You will likely need help to do all this, so please ask me.
  • After this (if on a Mac), reload R and install the library as below

To install the library (whether on Mac or Windows or otherwise), run this from R:

install.packages("https://cran.r-project.org/src/contrib/Archive/emIRT/emIRT_0.0.13.tar.gz", type="source")

Understanding Barberá (2015) via simulation (optional)

To understand a model like this, researchers who implement these types of models often simulate fake data to mimic the process that the model captures. Writing code to simulate data this way will give you a much better understanding of how these models work. In some sense, if you cannot simulate data for a model, you probably do not really understand how it works. Below, I provide code that walks through the whole data-generating process (DGP) of the model by Barberá (2015). The code is relatively short and is commented to explain each step.

Code for simulating data from the Barberá (2015) follower model DGP: Barbera_Ideology_DGP.R