Chris Kenny, PhD

@chriskenny.bsky.social

Postdoc, Princeton DDSS. PhD '25 Government @harvard.edu. Studies redistricting with #rstats. https://christophertkenny.com/

Thrilled to share that I received POLMETH's Statistical Software Award for 2026 for the #rstats package geomander. It's a performant toolkit for working with spatial data, especially election and demographic data. Learn more about the package at christophertkenny.com/geomander/

Geographic Tools for Studying Gerrymandering

A compilation of tools to complete common tasks for studying gerrymandering. This focuses on the geographic tool side of common problems, such as linking different levels of spatial units or estimatin...

christophertkenny.com

3 new projects: 1/3 an Algorithmic Redistricting Atlas. Explore congressional redistricting across enacted, simulated, and optimized maps. It has data for the last 5 presidential elections, and you can swing the national baseline.

Bild

If you do record linkage in #rstats, I'd love your feedback on irelink: Fast Probabilistic Record Linkage. It is a port of Python's splink package, rewritten with a clean, pipeable R interface. All of the magic happens in a database backend (default is DuckDB) so it's incredibly fast.

BildFind duplicate records within a single dataset. The bundled fake_20 dataset provides a small example for experimentation. irelink pushes data into a SQL database for efficient pair generation, so you need a DBI connection. Here we use an in-memory DuckDB instance.An il_spec describes the linkage model: which fields to compare, how to compare them, and which blocking rules to apply. Blocking rules restrict which record pairs are generated. Only pairs that share a surname or first name are scored, keeping computation manageable. il_estimate_u() estimates parameters for non-matching pairs via random sampling, and il_estimate_em() refines the match-weight parameters using Expectation-Maximization.
spec <- il_spec() |>
  il_compare(first_name, cl_jaro_winkler(0.9, 0.7)) |>
  il_compare(surname, cl_jaro_winkler(0.9, 0.7)) |>
  il_compare(dob, cl_exact()) |>
  il_block_on(surname) |>
  il_block_on(first_name)

model <- il_model(df, spec = spec, con = con)
model <- il_estimate_u(model)
model <- il_estimate_em(model, block_on(surname))
predict() scores all candidate pairs and returns those above the match-probability threshold. The returned match_weight is the evidence-only log2 Bayes factor; total_match_weight adds the prior odds used to compute match_probability. il_cluster() groups the matched pairs into deduplicated entities.

This is also not quite true. Empirically, states with independent commissions or nonpartisan drawers produce maps that are at or near the median simulation on partisan + racial demographics. Because of that, it's reasonable to treat the median as a forecast for a drawer following only certain rules

Stephen Wolf@stephenwolf.bsky.social · 3mo ago

6) Taking the median outcome of an algorithm-drawn map sample as the likeliest outcome rests on a fallacy that any map is equally likely to be chosen. But maps aren't drawn randomly. If one bad choice yields 10 variants while a good choice instead yields 2, that doesn't make the latter less likely

Unfortunately some inaccurate info in this thread. The point of the NYT sims was to see what typical maps drawn without the VRA would look like. But the maps Stephen draws incorporate VRA compliance. Also wrong info on the algorithms which I will say more about separately

Stephen Wolf@stephenwolf.bsky.social · 3mo ago

The NYT's maps would hurt Black voters & are de facto GOP gerrymanders. The whole premise is flawed. It’s nonsensical that Dems would 𝘭𝘰𝘴𝘦 a seat with "colorblind" nonpartisan maps—the GOP gerrymandered every state here except for AL & LA. Here's how nonpartisan maps might actually look. [Thread]

Updated Positron + Quarto + Quarto VSCode extension at the same time and the preview doesn't work anymore because it appends --output-directory, which is invalid in most cases... Codex followed the ctrl+shift+k -> found the issue -> fixed the extension's typescript so it works! Pretty impressive

Doing a lot of testing of AI agents with my team these days. Pulled together a new package, wf, which helps install and manage agent skills from within #rstats (A great time to be at Princeton DDSS; our team has an intro to Claude workshop today and an intro to Posit Assistant workshop next week!)

Post nicht verfügbar.

Doing some testing with codex in #rstats. It seems quite a bit behind Claude Code... Does anyone know if there is a clean way to give codex access to `.libPaths()` (ie, C:/Users/chris/AppData/Local/R/win-library/4.5 AND C:/Program Files/R/R-4.5.2/library) without giving it full powershell access?

If you use #QuartoPub for any PDF documents for teaching and you need to meet impending PDF accessibility rules, upgrade to v1.9, add format: typst: pdf-standard: ua-1 to the YAML front matter, and it'll work!

Accessibility score for: evalsp26_01-exam_answers
100% Accessibility score: 100 percent
arrow_drop_up
Perfect!

This PDF has a perfect accessibility score, although further improvements may still be possible. Keep up the good work!

News for #RStats folks who use RStudio and are interested in AI, via @posit.co: "AI in RStudio is here. We’ve embedded a specialized agent, Posit Assistant, directly into RStudio, transforming the IDE into a powerful, context-aware collaborator for data analysis." It's a $20/mo subscription.

Introducing AI in RStudio

Today we’re introducing AI in RStudio. We’ve embedded a specialized agent directly into RStudio so it can read your live session context and provide more accurate assistance for data science and analy...

posit.co