Install the app

Install this application on your home screen for quick and easy access when you’re on the go.

Just tap Share then “Add to Home Screen”


Install the app

Install this application on your home screen for quick and easy access when you’re on the go.

Just tap Share then “Add to Home Screen”

Your subscription could not be saved. Please try again.
Your subscription to the ECPR Methods School offers and updates newsletter has been successful.

Discover ECPR's Latest Methods Course Offerings

We use Brevo as our email marketing platform. By clicking below to submit this form, you acknowledge that the information you provided will be transferred to Brevo for processing in accordance with their terms of use.


Quantitative Text Analysis and Machine Learning using R

Course Dates and Times

Monday 31 July – Friday 4 August 2023
Minimum 2 hours of live teaching per day
14:00 – 17:00 CEST

Zachary Greene

University of Strathclyde

This course offers an immersive online learning environment that employs state-of-the-art pedagogical tools. With a maximum of 16 participants, our teaching team can provide personalised attention to each individual, catering to their specific needs. The course is designed for a demanding audience, including researchers, professional analysts, and advanced students.

Purpose of the course

The abundance of textual data in modern times provides a rich source of information on social and political behavior. As a result, social scientists have increasingly turned to computational or computer-assisted methods to extract insights from this data. This course is designed to equip you with the foundational knowledge and skills required to manage and analyse textual data using R.

Upon completion of the course, you will:

  • develop a conceptual understanding of basic approaches to natural language processing;
  • gain familiarity with common quantitative text analysis techniques used in political science literature and be able to interpret the results; and
  • learn how to implement the most widely used methods employed by social scientists.

The course covers the following topics:

  • The Fundamentals of quantitative text analysis using machine learning.
  • Estimation of dictionary, sentiment, topic, and scaling models.
  • Methods for text classification using supervised machine learning.
  • Word embeddings and textual representation models.
ECTS Credits

4 credits - Engage fully in class activities and complete a post-class assignment

Instructor Bio

Zachary Greene is a Reader at the University of Strathclyde. His research interests include quantitative text analysis and machine learning approaches to studying political parties, parliaments and elections.

His work has been published in journals including, the British Journal of Political Science, European Journal of Political Research, Journal of European Public Policy, Party Politics and Electoral Studies. You can find more information on Dr Greene’s research, teaching and ongoing projects at


Thanks to the advancements in personal computing and the internet, humans now produce an overwhelming amount of textual data. While social scientists have traditionally employed quantitative and qualitative content analysis techniques to read and annotate texts manually, the recent breakthroughs in computational approaches to natural language processing have made it possible for researchers to manage and analyse much larger datasets. With these new tools, social scientists can now study a range of topics that were previously inaccessible due to resource constraints, such as organisational ideology, media bias and sentiment, policy change, social media, and information diffusion.

The goal of this course is to equip students with the knowledge and skills to harness computational approaches to analyse text data. By the end of the course, you will:

  • understand the conceptual framework and data management techniques necessary for analysing text data as data, including the fundamentals of natural language processing using machine learning;
  • be familiar with common computational approaches to text analysis that are widely used in political and social sciences;
  • be introduced to advanced methods for managing and analysing text data using embeddings approaches.

Overall, the course aims to provide you with the tools and techniques you need to develop projects that utilise computational approaches to text analysis.

Key topics covered

Day 1: Introduction to Quantitative Text Analysis using R

This session will introduce the theoretical assumptions and key concepts for performing quantitative text analysis, and will showcase several features of the Quanteda package in R. Through examples, the session will illustrate how researchers can use both quantitative and qualitative analysis to gain insights from textual data.

Day 2: Dictionaries and Sentiment Analysis

Keyword searches and dictionary-based approaches offer a straightforward method for analyzing most texts. One practical application is the study of sentiment, as text often contains clues to the writer's tone, emotion, or attitude. In this session, we will provide an overview of commonly used techniques for extracting this information in political contexts.

Day 3: Scaling and Topic Models

Scholars interested in identifying differences between texts based on underlying concepts such as ideology or institutional origin often turn to scaling and topic models. This session will introduce Wordfish and Wordscores, two common scaling models, and provide an overview of approaches for validating their estimates. The session will also cover topic models, which can reveal a set of topics within documents with little prior knowledge of their contents. Specifically, the classical LDA model and the Structural Topic Model will be discussed. Finally, the session will explore various applications of these tools.

Day 4: Introduction to Classification and Supervised Machine Learning

Supervised approaches to text classification involve using existing annotated text to predict the content of uncoded texts. These methods have enabled major advancements in artificial intelligence, and are widely used by organisations like Google and Facebook for analysing massive corpora of text. In addition, these approaches are highly relevant for measuring political concepts. This session will cover the logic of training and evaluating classification models, followed by exploration of specific applications in political science.

Classification based approaches can be used to predict values of interest such as the issues and positions, sentiment or emotions, and other dimensions of text that researchers have traditionally used content analysis to derive.

Day 5: Advanced Topics in Quantitative Text Analysis

This session will cover a set of advanced topics in quantitative text analysis including word embeddings and textual representations, data management, hypothesis testing and data visualisation.

How the course will work online

This course is structured around lectures and labs, with each session comprising a 1.5-hour lecture followed by a 1.5-hour lab. The lectures will provide an overview of relevant concepts and statistical foundations necessary to apply machine learning approaches to textual data, as well as highlight recent applications of these methods in the social sciences. The lab sessions will allow students to gain hands-on experience by applying these methods to political and social science data using common R packages, including the quanteda suite.

It is important to note that this course serves as an introduction to these topics. While you will gain a solid understanding of the subject and practical experience, the course will not cover advanced topics in depth during the one-week session.

Prior knowledge of R and quantitative methods is required for this class. In the live sessions, you will receive hands-on instruction on performing quantitative text analysis and machine learning using R.

Each course includes pre-course assignments, including readings and pre-recorded videos, as well as daily live lectures totalling at least three hours. The instructor will conduct live Q&A sessions and offer designated office hours for one-to-one consultations.

Please check your course format before registering.

Online courses

Live classes will be held daily for three hours on a video meeting platform, allowing you to interact with both the instructor and other participants in real-time. To avoid online fatigue, the course employs a pedagogy that includes small-group work, short and focused tasks, as well as troubleshooting exercises that utilise a variety of online applications to facilitate collaboration and engagement with the course content.

In-person courses

In-person courses will consist of daily three-hour classroom sessions, featuring a range of interactive in-class activities including short lectures, peer feedback, group exercises, and presentations.


This course description may be subject to subsequent adaptations (e.g. taking into account new developments in the field, participant demands, group size, etc.). Registered participants will be informed at the time of change.

By registering for this course, you confirm that you possess the knowledge required to follow it. The instructor will not teach these prerequisite items. If in doubt, please contact us before registering.