X No Longer Marks the Spot: Debates, Nominations, and Diverging Platforms

# Replication package Code and data behind the analyses reported in the manuscript, organised intwo collection waves: the 2024 campaign (Python) and the 2020 campaign (R andStata). The files have been prepared for anonymous peer review (see*Anonymisation*). ## Contents | File | Role | Format ||---|---|---|| `use2024_data_collector.py` | Scrapes, every ~30 minutes, the online-popularity, polling and prediction-market indicators of the two 2024 candidates and appends them to a cumulative database. | Python 3 || `USE20204-DB.csv` | Raw output of the collector: 3,927 runs, 25 July 2024 - 3 January 2025, 58 columns (raw column names). | CSV || `USE20204-DB-Final-clean.xlsx` | The checked collector output used as input of the processing script (sheet `Clean_v1`), together with the intermediate sheets of the checking stage. | Excel || `use2024_data_processing.py` | Prepares the 2024 panel (imputation, growth rates, differentials, stationarity, autocorrelation correction), runs the factor analysis (iterative merging of collinear groups, final five-factor model, Bartlett scores) and draws the figures, including the PRISMA-style diagram of the literature screening. | Python 3 || `db_use2024.csv` | The 2024 panel as produced by stage 1 of the processing script: 3,872 observations (25 July - 5 November 2024, about 40 minutes apart) x 145 columns. | CSV || `requirements.txt` | Exact Python package versions of the reference run. | text || `use2020_data_collector.R` | Scraper of the 2020 wave (X/Twitter API, YouTube, RealClearPolitics, Betfair, Facebook pages and groups). | R || `USE2020.dta` | The 2020 panel: 1,210 observations (24 July - 3 November 2020) x 54 variables, with variable labels. | Stata 14+ || `use2020_stationarity.do` | Autocorrelation correction (autoregressive filtering) and stationarity (ADF test with differencing) of the 2020 series; logs the transformation of each variable. | Stata || `USE2020-stationary.dta` | The 2020 panel extended with the transformed series (173 variables); output of the stationarity do-file and input of the analysis do-file. | Stata 14+ || `use2020_analysis.do` | Correlations, assumption checks and exploratory factor analysis (varimax) of the 2020 wave. | Stata || `scopus_shortlisting_query_results_processing.xlsx` | Literature screening: Scopus query results (425 records), screening decisions (`Relevant_topic`, `Internet_Sources`, `Issues`), derived pivot tables and charts, and the counts used in the PRISMA-style diagram (425 identified, 324 relevant, 304 included). | Excel | ## Pipeline ```2024 wave use2024_data_collector.py -> USE20204-DB.csv (raw runs) | checking and gap filling (USE20204-DB-Final-clean.xlsx) v USE20204-DB-Final-clean.xlsx, sheet Clean_v1 | use2024_data_processing.py, stage 1 v db_use2024.csv (published panel) summary_statistics.docx use2024_stationary_autocorrected.xlsx autocorr_corrected_vars.xlsx | stage 2 v factor_loadings_temp*.xlsx (27 rounds) factor_loadings_final.xlsx factor_analysis_outputs.xlsx (final variable set, Bartlett factor scores, metadata, quartimax loadings) | stage 3 v figures (interactive) and PRISMA-style_Sankey.png 2020 wave use2020_data_collector.R -> USE2020R-DB.csv -> USE2020.dta | use2020_stationarity.do (autocorrelation correction, then | differencing; logs in stationary_series.xlsx) v USE2020-stationary.dta -> use2020_analysis.do -> stationary_series.xlsx``` ## Running the code ### Configuration and credentials Every script starts with a *Configuration* block. Paths default to the foldercontaining the script and can be overridden with the environment variable`USE2024_PROJECT_DIR` (Python) or `USE2020_PROJECT_DIR` (R); the Statado-file uses the global `PROJECT_DIR`. Credentials are read from environmentvariables and are not part of the package: | Variable | Used by | Purpose ||---|---|---|| `USE2024_IG_USER_1`, `USE2024_IG_PASSWORD_1`, `USE2024_IG_USER_2`, `USE2024_IG_PASSWORD_2` | `use2024_data_collector.py` | Instagram accounts for the `instaloader` fallback (alternated daily) || `TWITTER_APP_NAME`, `TWITTER_CONSUMER_KEY`, `TWITTER_CONSUMER_SECRET`, `TWITTER_ACCESS_TOKEN`, `TWITTER_ACCESS_SECRET` | `use2020_data_collector.R` | Twitter API v1.1 application (rtweet 0.7) | The 2024 collector also expects two pickled Selenium cookie jars(`cookie_rcl`, `cookie_insta`) in the project folder, created by logging inmanually once; they are refreshed at every run. ### Software * **Python 3.13** with the packages listed in `requirements.txt` (exact versions of the reference run). Two of them matter for reproducibility: pandas 2.2 (pandas 3 no longer interpolates frames that contain string columns nor down-casts object columns after `fillna`, both used in stage 1) and NumPy 2.2 (NumPy 2.5 raises a `TypeError` on the scalar conversion of the F statistic in `actest_robust`). The versions of `plotly` and `kaleido` (Sankey diagram only) were not recorded.* **R** with `XML`, `stringr`, `rtweet` (0.7.x, Twitter API v1.1), `reticulate` and `tidyverse`, plus a Python environment with `requests`, `beautifulsoup4` and `lxml` reachable through reticulate. Package versions were not recorded.* **Stata 14 or later** with the SSC commands `matpwcorr` and `factortest`. Both collectors depend on page layouts and services as they were during therespective campaigns (SocialBlade, tokcount.com, the Twitter v1.1 API, astatic mirror of electionbettingodds.com, Facebook page metadata) and areprovided to document the collection procedure rather than to be re-run. ### Order of execution (2020) 1. `use2020_data_collector.R` (one row per run) -> `USE2020R-DB.csv`, saved as `USE2020.dta`.2. `use2020_stationarity.do` -> `USE2020-stationary.dta`.3. `use2020_analysis.do`. ### Order of execution (2024) 1. `use2024_data_collector.py` (continuous loop; one row per run) -> `USE20204-DB.csv`.2. Checking of the raw database in `USE20204-DB-Final-clean.xlsx`: the runs retained for the study (sheet `USE20204-DB-Final`), gaps in the collection filled by linear interpolation and flagged (`No_missed_data_points`), the FiveThirtyEight (`538All`, `538forecasts`) and Google Trends (`GTrends`) series added, column names harmonised (`var names` maps the raw names to the harmonised ones) and the final sheet `Clean_v1` (3,873 rows, 25 July - 5 November 2024). `CLeaning notes` records two decisions taken at this stage.3. `use2024_data_processing.py`, stages 1-3 (sequential; each stage reads the files written by the previous one, so a stage can be re-run on its own once its inputs exist). ## Codebook: `db_use2024.csv` ### Naming conventions * `_t` Trump; `_b` the Democratic candidate. The collector was written for Joe Biden and the suffix was kept after Kamala Harris became the nominee (21 July 2024); every observation in the panel post-dates the switch, so `_b` series describe Harris's accounts and the Democratic campaign's accounts. The raw column names in `USE20204-DB.csv` use `trump`/`biden` and `_t`/`_b` interchangeably; sheet `var names` of the checked workbook maps them to the harmonised names used here.* `<stem>_t`, `<stem>_b`: level of the indicator.* `<stem>_p_t`, `<stem>_p_b`: growth rate between consecutive observations (`pct_change`); infinite values (growth from zero) set to missing, and missing Google Trends growth rates set to 0.* `<stem>_p_t_w`: differential of the two candidates' growth rates, `<stem>_p_t - <stem>_p_b`. Computed only for indicators observed separately for each candidate (polls and markets are not differenced).* Opposing Facebook pages carry a double suffix: `*_opp_group_t_b` is the page opposing Trump and `*_opp_group_b_t` the page opposing the Democratic candidate. Their growth differential is `*_opp_group_w_t` (`*_opp_group_b_p_t - *_opp_group_t_p_b`).* Columns created downstream by the processing script (not in the CSV): `l<k>_<name>` residual of an order-k autoregression of a stationary series (autocorrelation-corrected series); `<name>_F1` single-factor composite of a group of collinear series. ### Metadata columns | Column | Content ||---|---|| `timedate` | collection date (yyyy-mm-dd) || `timehour` | collection time (hh:mm:ss.ffffff) || `Added missing data points` | 1 = row inserted at the checking stage to fill a gap in the collection (values linearly interpolated); 0 = collected by the scraper || `time diff` | time elapsed since the previous observation (hh:mm:ss.ffffff) || `time diff num` | the same, in days || `errors` | list of the indicators that failed in the run (tags as in the collector, e.g. `B_TTok`, `rcl`); empty list = none; missing for inserted rows | ### Indicators (139 columns) | Stem | Measure | Source | Columns | Notes ||---|---|---|---|---|| `Y_view` | views of the reference campaign video | YouTube | `Y_view_t`, `Y_view_b`, `Y_view_p_t`, `Y_view_p_b`, `Y_view_p_t_w` | || `Y_like` | likes of the reference campaign video | YouTube | `Y_like_t`, `Y_like_b`, `Y_like_p_t`, `Y_like_p_b`, `Y_like_p_t_w` | || `rcl` | national polling average (vote share, %) | RealClearPolling | `rcl_t`, `rcl_b`, `rcl_p_t`, `rcl_p_b` | no `_w` || `predictit` | last close price of the candidate's contract | PredictIt (market 7456) | `predictit_t`, `predictit_b`, `predictit_p_t`, `predictit_p_b` | no `_w` || `betting_temp` | aggregate win odds (%) | electionbettingodds.com | `betting_temp_t`, `betting_temp_b`, `betting_temp_p_t`, `betting_temp_p_b` | no `_w` || `bf_temp_mid` | Betfair mid-quote (%) | electionbettingodds.com | `bf_temp_mid_t`, `bf_temp_mid_b`, `bf_temp_mid_p_t`, `bf_temp_mid_p_b` | no `_w` || `poly_temp_mid` | Polymarket mid-quote (%) | electionbettingodds.com | `poly_temp_mid_t`, `poly_temp_mid_b`, `poly_temp_mid_p_t`, `poly_temp_mid_p_b` | no `_w` || `pred_temp_mid` | PredictIt mid-quote (%) | electionbettingodds.com | `pred_temp_mid_t`, `pred_tem

Authors

Publication Details

Journal
Zenodo (CERN European Organization for Nuclear Research)
Published
2026-11-26
DOI
https://doi.org/10.5281/zenodo.24549710
Primary Topic
Electoral Systems and Political Participation
Type
article
Field-Weighted Citation Impact
0.00
Controls
|||
ALL TIME
JAN
FEB
MAR
APR
MAY
JUN
JUL
AUG
SEP
OCT
NOV
article

X No Longer Marks the Spot: Debates, Nominations, and Diverging Platforms

Fabio Franch
Zenodo (CERN European Organization for Nuclear Research)
Electoral Systems and Political Participation
article

X No Longer Marks the Spot: Debates, Nominations, and Diverging Platforms

Fabio Franch
article en

Abstract

# Replication package Code and data behind the analyses reported in the manuscript, organised intwo collection waves: the 2024 campaign (Python) and the 2020 campaign (R andStata). The files have been prepared for anonymous peer review (see*Anonymisation*). ## Contents | File | Role | Format ||---|---|---|| `use2024_data_collector.py` | Scrapes, every ~30 minutes, the online-popularity, polling and prediction-market indicators of the two 2024 candidates and appends them to a cumulative database. | Python 3 || `USE20204-DB.csv` | Raw output of the collector: 3,927 runs, 25 July 2024 - 3 January 2025, 58 columns (raw column names). | CSV || `USE20204-DB-Final-clean.xlsx` | The checked collector output used as input of the processing script (sheet `Clean_v1`), together with the intermediate sheets of the checking stage. | Excel || `use2024_data_processing.py` | Prepares the 2024 panel (imputation, growth rates, differentials, stationarity, autocorrelation correction), runs the factor analysis (iterative merging of collinear groups, final five-factor model, Bartlett scores) and draws the figures, including the PRISMA-style diagram of the literature screening. | Python 3 || `db_use2024.csv` | The 2024 panel as produced by stage 1 of the processing script: 3,872 observations (25 July - 5 November 2024, about 40 minutes apart) x 145 columns. | CSV || `requirements.txt` | Exact Python package versions of the reference run. | text || `use2020_data_collector.R` | Scraper of the 2020 wave (X/Twitter API, YouTube, RealClearPolitics, Betfair, Facebook pages and groups). | R || `USE2020.dta` | The 2020 panel: 1,210 observations (24 July - 3 November 2020) x 54 variables, with variable labels. | Stata 14+ || `use2020_stationarity.do` | Autocorrelation correction (autoregressive filtering) and stationarity (ADF test with differencing) of the 2020 series; logs the transformation of each variable. | Stata || `USE2020-stationary.dta` | The 2020 panel extended with the transformed series (173 variables); output of the stationarity do-file and input of the analysis do-file. | Stata 14+ || `use2020_analysis.do` | Correlations, assumption checks and exploratory factor analysis (varimax) of the 2020 wave. | Stata || `scopus_shortlisting_query_results_processing.xlsx` | Literature screening: Scopus query results (425 records), screening decisions (`Relevant_topic`, `Internet_Sources`, `Issues`), derived pivot tables and charts, and the counts used in the PRISMA-style diagram (425 identified, 324 relevant, 304 included). | Excel | ## Pipeline ```2024 wave use2024_data_collector.py -> USE20204-DB.csv (raw runs) | checking and gap filling (USE20204-DB-Final-clean.xlsx) v USE20204-DB-Final-clean.xlsx, sheet Clean_v1 | use2024_data_processing.py, stage 1 v db_use2024.csv (published panel) summary_statistics.docx use2024_stationary_autocorrected.xlsx autocorr_corrected_vars.xlsx | stage 2 v factor_loadings_temp*.xlsx (27 rounds) factor_loadings_final.xlsx factor_analysis_outputs.xlsx (final variable set, Bartlett factor scores, metadata, quartimax loadings) | stage 3 v figures (interactive) and PRISMA-style_Sankey.png 2020 wave use2020_data_collector.R -> USE2020R-DB.csv -> USE2020.dta | use2020_stationarity.do (autocorrelation correction, then | differencing; logs in stationary_series.xlsx) v USE2020-stationary.dta -> use2020_analysis.do -> stationary_series.xlsx``` ## Running the code ### Configuration and credentials Every script starts with a *Configuration* block. Paths default to the foldercontaining the script and can be overridden with the environment variable`USE2024_PROJECT_DIR` (Python) or `USE2020_PROJECT_DIR` (R); the Statado-file uses the global `PROJECT_DIR`. Credentials are read from environmentvariables and are not part of the package: | Variable | Used by | Purpose ||---|---|---|| `USE2024_IG_USER_1`, `USE2024_IG_PASSWORD_1`, `USE2024_IG_USER_2`, `USE2024_IG_PASSWORD_2` | `use2024_data_collector.py` | Instagram accounts for the `instaloader` fallback (alternated daily) || `TWITTER_APP_NAME`, `TWITTER_CONSUMER_KEY`, `TWITTER_CONSUMER_SECRET`, `TWITTER_ACCESS_TOKEN`, `TWITTER_ACCESS_SECRET` | `use2020_data_collector.R` | Twitter API v1.1 application (rtweet 0.7) | The 2024 collector also expects two pickled Selenium cookie jars(`cookie_rcl`, `cookie_insta`) in the project folder, created by logging inmanually once; they are refreshed at every run. ### Software * **Python 3.13** with the packages listed in `requirements.txt` (exact versions of the reference run). Two of them matter for reproducibility: pandas 2.2 (pandas 3 no longer interpolates frames that contain string columns nor down-casts object columns after `fillna`, both used in stage 1) and NumPy 2.2 (NumPy 2.5 raises a `TypeError` on the scalar conversion of the F statistic in `actest_robust`). The versions of `plotly` and `kaleido` (Sankey diagram only) were not recorded.* **R** with `XML`, `stringr`, `rtweet` (0.7.x, Twitter API v1.1), `reticulate` and `tidyverse`, plus a Python environment with `requests`, `beautifulsoup4` and `lxml` reachable through reticulate. Package versions were not recorded.* **Stata 14 or later** with the SSC commands `matpwcorr` and `factortest`. Both collectors depend on page layouts and services as they were during therespective campaigns (SocialBlade, tokcount.com, the Twitter v1.1 API, astatic mirror of electionbettingodds.com, Facebook page metadata) and areprovided to document the collection procedure rather than to be re-run. ### Order of execution (2020) 1. `use2020_data_collector.R` (one row per run) -> `USE2020R-DB.csv`, saved as `USE2020.dta`.2. `use2020_stationarity.do` -> `USE2020-stationary.dta`.3. `use2020_analysis.do`. ### Order of execution (2024) 1. `use2024_data_collector.py` (continuous loop; one row per run) -> `USE20204-DB.csv`.2. Checking of the raw database in `USE20204-DB-Final-clean.xlsx`: the runs retained for the study (sheet `USE20204-DB-Final`), gaps in the collection filled by linear interpolation and flagged (`No_missed_data_points`), the FiveThirtyEight (`538All`, `538forecasts`) and Google Trends (`GTrends`) series added, column names harmonised (`var names` maps the raw names to the harmonised ones) and the final sheet `Clean_v1` (3,873 rows, 25 July - 5 November 2024). `CLeaning notes` records two decisions taken at this stage.3. `use2024_data_processing.py`, stages 1-3 (sequential; each stage reads the files written by the previous one, so a stage can be re-run on its own once its inputs exist). ## Codebook: `db_use2024.csv` ### Naming conventions * `_t` Trump; `_b` the Democratic candidate. The collector was written for Joe Biden and the suffix was kept after Kamala Harris became the nominee (21 July 2024); every observation in the panel post-dates the switch, so `_b` series describe Harris's accounts and the Democratic campaign's accounts. The raw column names in `USE20204-DB.csv` use `trump`/`biden` and `_t`/`_b` interchangeably; sheet `var names` of the checked workbook maps them to the harmonised names used here.* `<stem>_t`, `<stem>_b`: level of the indicator.* `<stem>_p_t`, `<stem>_p_b`: growth rate between consecutive observations (`pct_change`); infinite values (growth from zero) set to missing, and missing Google Trends growth rates set to 0.* `<stem>_p_t_w`: differential of the two candidates' growth rates, `<stem>_p_t - <stem>_p_b`. Computed only for indicators observed separately for each candidate (polls and markets are not differenced).* Opposing Facebook pages carry a double suffix: `*_opp_group_t_b` is the page opposing Trump and `*_opp_group_b_t` the page opposing the Democratic candidate. Their growth differential is `*_opp_group_w_t` (`*_opp_group_b_p_t - *_opp_group_t_p_b`).* Columns created downstream by the processing script (not in the CSV): `l<k>_<name>` residual of an order-k autoregression of a stationary series (autocorrelation-corrected series); `<name>_F1` single-factor composite of a group of collinear series. ### Metadata columns | Column | Content ||---|---|| `timedate` | collection date (yyyy-mm-dd) || `timehour` | collection time (hh:mm:ss.ffffff) || `Added missing data points` | 1 = row inserted at the checking stage to fill a gap in the collection (values linearly interpolated); 0 = collected by the scraper || `time diff` | time elapsed since the previous observation (hh:mm:ss.ffffff) || `time diff num` | the same, in days || `errors` | list of the indicators that failed in the run (tags as in the collector, e.g. `B_TTok`, `rcl`); empty list = none; missing for inserted rows | ### Indicators (139 columns) | Stem | Measure | Source | Columns | Notes ||---|---|---|---|---|| `Y_view` | views of the reference campaign video | YouTube | `Y_view_t`, `Y_view_b`, `Y_view_p_t`, `Y_view_p_b`, `Y_view_p_t_w` | || `Y_like` | likes of the reference campaign video | YouTube | `Y_like_t`, `Y_like_b`, `Y_like_p_t`, `Y_like_p_b`, `Y_like_p_t_w` | || `rcl` | national polling average (vote share, %) | RealClearPolling | `rcl_t`, `rcl_b`, `rcl_p_t`, `rcl_p_b` | no `_w` || `predictit` | last close price of the candidate's contract | PredictIt (market 7456) | `predictit_t`, `predictit_b`, `predictit_p_t`, `predictit_p_b` | no `_w` || `betting_temp` | aggregate win odds (%) | electionbettingodds.com | `betting_temp_t`, `betting_temp_b`, `betting_temp_p_t`, `betting_temp_p_b` | no `_w` || `bf_temp_mid` | Betfair mid-quote (%) | electionbettingodds.com | `bf_temp_mid_t`, `bf_temp_mid_b`, `bf_temp_mid_p_t`, `bf_temp_mid_p_b` | no `_w` || `poly_temp_mid` | Polymarket mid-quote (%) | electionbettingodds.com | `poly_temp_mid_t`, `poly_temp_mid_b`, `poly_temp_mid_p_t`, `poly_temp_mid_p_b` | no `_w` || `pred_temp_mid` | PredictIt mid-quote (%) | electionbettingodds.com | `pred_temp_mid_t`, `pred_tem

Zenodo (CERN European Organization for Nuclear Research)
Electoral Systems and Political Participation
AI Navigator

Ask Laika to Summarize, Analyze, and Connect papers live on the map.

Summarize Papers & Methodologies

Extract key findings, datasets, and comparative methods across publications.

Benchmark Rankings & Visual Analytics

Rank top research institutions, authors, funders, topics, and journals by Field-Weighted Citation Impact (FWCI) and paper volume with instant charts.

Connect Distant Disciplines

Bridge topological clusters on the map to find hidden collaborative intersections.

Laika access coming soon