Doing Computational Social Science: A Practical Introduction

(2022) London, UK: SAGE

John McLevey

University of Waterloo


May 9, 2022


Computational approaches offer exciting opportunities for us to do social science differently. This beginner’s guide discusses a range of computational methods and how to use them to study the problems and questions you want to research.

It assumes no knowledge of programming, offering step-by-step guidance for coding in Python and drawing on examples of real data analysis to demonstrate how you can apply each approach in any discipline.

The book also:

  • Considers important principles of social scientific computing, including transparency, accountability and reproducibility.
  • Understands the realities of completing research projects and offers advice for dealing with issues such as messy or incomplete data and systematic biases.
  • Empowers you to learn at your own pace, with online resources including screencast tutorials and datasets that enable you to practice your skills and get up to speed.

For anyone who wants to use computational methods to conduct a social science research project, this book equips you with the skills, good habits and best working practices to do rigorous, high quality work.


Introduction | Learning to do computational social science

Part I: Foundations

Chapter 1 | Setting up your open source scientific computing environment

Chapter 2 | Python programming: The basics

Chapter 3 | Python programming: Data structures, functions and files

Chapter 4 | Collecting data from Application Programming Interfaces (APIs)

Chapter 5 | Collecting data from the web (Scraping)

Chapter 6 | Processing structured data

Chapter 7 | Visualisation and exploratory data analysis

Chapter 8 | Latent factors and components

Part II: Fundamentals of text analysis

Chapter 9 | Processing natural language data

Chapter 10 | Iterative text analysis

Chapter 11 | Exploratory text analysis

Chapter 12 | Text similarity and latent semantic space

Part III: Fundamentals of network analysis

Chapter 13 | Social networks and relational thinking

Chapter 14 | Connection and clustering in social networks

Chapter 15 | Influence, inequality and power in social networks

Chapter 16 | Going viral: Modelling the epidemic spread of simple contagions

Chapter 17 | Not so fast: Modelling the diffusion of complex contagions

Part IV: Research ethics and machine learning

Chapter 18 | Research ethics, politics and practices

Chapter 19 | Machine learning: Symbolic and connectionist

Chapter 20 | Supervised learning with regression and cross-validation

Chapter 21 | Supervised learning with tree-based models

Chapter 22 | Neural networks and deep learning

Chapter 23 | Developing neural network models with Keras and Tensorflow

Part V: Bayesian machine learning and probabilistic programming

Chapter 24 | Statistical machine learning and generative models

Chapter 25 | Probability: A primer

Chapter 26 | Approximate posterior inference with stochastic sampling and MCMC

Part VI: Bayesian data analysis and latent variable modelling with relational and text data

Chapter 27 | Bayesian regression models with probabilistic programming

Chapter 28 | Bayesian hierarchical regression modelling

Chapter 29 | Variational Bayes and the craft of generative topic modelling

Chapter 30 | Generative network analysis with Bayesian stochastic blockmodels

Part VII: Embeddings, transformer models and named entity recognition

Chapter 31 | Can we model meaning?: Contextual representation and neural word embeddings

Chapter 32 | Named entity recognition, transfer learning and transformer models


BibTeX citation:
  author = {McLevey, John},
  publisher = {SAGE},
  title = {Doing {Computational} {Social} {Science:} {A} {Practical}
  date = {2022-05-09},
  address = {London, UK},
  langid = {en}
For attribution, please cite this work as:
McLevey, John. 2022. Doing Computational Social Science: A Practical Introduction. London, UK: SAGE.