Twitter data discourses about COVID vaccine

Read full text
Authors: Regina Cheng
Cited by: 0

Abstract

This repository contains the data and code required to replicate the results reported in the paper: "Conspiracist attributes differentiate pro- and anti-vaccine online discourses about data." ## Repository Structure ``` notebooks/ Analysis pipeline: five Python notebooks and one R notebook, run sequentially. data/ raw/ Dehydrated tweet IDs (tweet IDs only, no content). hydrated/ (empty - the fully hydrated tweet datasets are available upon request.) intermediate/ (empty - populated when notebooks 01-04 run) analysis/ Analysis-ready CSVs produced by 05, consumed by 06_full_analysis.Rmd, plus the keyword flags and LLM stance codes added in the 2026 revision. keywords/ Search terms used to collect anti- and pro-vaccine tweets (see Data Collection). ``` The pipeline consists of five Python notebooks and one R notebook, which must be run sequentially: `notebooks/00_collect_data_from_twitter.ipynb` through `notebooks/06_full_analysis.Rmd`. Each notebook is written assuming it runs from inside `notebooks/`, and reads/writes paths relative to that directory (e.g. `../data/hydrated/anti_vax.json`). ## Data Collection `notebooks/00_collect_data_from_twitter.ipynb` contains the code used to collect the original Twitter data. The data collection produces two tweet datasets: anti-vaccine data discourse and pro-vaccine data discourse. Pro-vaccine tweets were collected by hashtag search (`data/keywords/provax_keywords.txt`, 18 hashtags). Anti-vaccine tweets were collected by plain-keyword search (`data/keywords/antivax_keywords.txt`, 60 keywords). Due to Twitter/X data-sharing restrictions, we provide dehydrated datasets (tweet IDs only): - `data/raw/anti_vax_ids.json` - `data/raw/pro_vax_ids.json` To proceed with variable construction, these tweet IDs must be rehydrated using the Twitter API. The fully hydrated tweet datasets are available upon request. The rehydrated data files should be placed at `data/hydrated/anti_vax.json` and `data/hydrated/pro_vax.json` in order to be used in the following analysis pipeline. ## Variable Construction The following notebooks construct the independent and control variables used in the paper's analyses: - `notebooks/01_construct_variable_certainty.ipynb` - `notebooks/02_construct_variable_causal_claims.ipynb` - `notebooks/03_construct_variable_authority_figures.ipynb` - `notebooks/04_construct_control_variables.ipynb` Details are provided in the Methods section of the paper. These notebooks write their intermediate outputs to `data/intermediate/`. Important: To run `01_construct_variable_certainty.ipynb` and `02_construct_variable_causal_claims.ipynb`, you must obtain the LIWC2015 English dictionary, which is available from https://liwc.app. ## Analysis Preparation `notebooks/05_preparing_analysis_tables.ipynb` combines the variables generated in notebooks 01-04 (from `data/intermediate/`) into analysis-ready CSV files. We provide these processed datasets directly as: - `data/analysis/authority_analysis.csv` - `data/analysis/causal_claims_analysis.csv` - `data/analysis/certainty_analysis.csv` ## Statistical Analysis `notebooks/06_full_analysis.Rmd` contains the R code that uses the three CSV files in `data/analysis/` above to reproduce all tables and figures reported in the paper. `notebooks/make_knitr_data.R` builds `output/knitr_data.RData`, which the paper and supplement load. It fits the models on three samples: the main sample (see below), the full sample, and the main sample without tweets from deleted or suspended accounts. ## 2026 Revision: Dropped Keywords Three anti-vaccine keywords (`unvaccinated`, `vaxxed`, `antivaccine`) were dropped from the main analysis because tweets matching them were at least as likely to be pro-vaccine as anti-vaccine. The full-keyword results appear in the supplement. - `data/analysis/ambiguous_keyword_flags.csv`: per tweet, whether the text contains each of the three keywords (whole word, case-insensitive). Produced by `notebooks/flag_ambiguous_keywords.py` from the hydrated tweets. - `data/analysis/llm_stance_codes.csv`: stance label (anti, pro, neutral) from an LLM classifier (Claude Sonnet) for every anti-vaccine tweet matching `unvaccinated`, `vaxxed`, `antivaccine`, or `depopulation`, and for every pro-vaccine tweet (term `provaccine`). - `data/analysis/llm_vs_human_2021.csv`: LLM labels against the 2021 hand coding of up to 10 tweets per anti-vaccine keyword (146 tweets; 84% agreement, Cohen's kappa 0.67). - `notebooks/llm_stance_coding/`: the codebook (`codebook.md`), the prompt and API script (`code_stance.py`), and the scripts that prepare inputs, summarize the codes, and run the comparison with the hand coding. None of the published files contain tweet text.

Fields of Study & Subjects

Misinformation and Its Impacts Vaccine Coverage and Hesitancy Communication and COVID-19 Impact

Publication details

Journal / source
Harvard Dataverse
Publication date
30 January 2026
Document type
Dataset