Bias-variance tradeoff in matching for diff-in-diff

In matching for causal inference, we often focus too much on reducing bias and too little on variance. This has generalizability implications. This paper, while not focused on external validity, tackles the bias-variance trade-off in matching for diff-in-diff:

While matching on covariates may reduce bias by creating a more comparable control group, this often comes at the cost of higher variance. Matching discards non-comparable control units, limiting the sample and, in turn, jeopardizing the precision of the estimate. That’s a good reminder.

How about matching also on pre-treatment outcomes?

Here, the win is clear: it’s a guaranteed reduction in variance because the sample-size trade-off no longer applies once matching is performed. So, while a reduction in bias isn’t a mathematical certainty, this makes additionally matching on pre-treatment outcomes a potentially optimal strategy when both bias and variance are a concern.

The generalizability implications will be part of the matching chapter of the Causal Book.

PS: Yes, matching on pre-treatment outcomes reduces the diff-in-diff estimator to diff-in-means and may introduce bias, but that’s a discussion for another day (and chapter).

Understand Code Before You Vibe It?

[Click title for image]

That tagline with the made-up graph instantly raises a red flag, but the core idea is surprisingly cool. Windsurf’s new owner, Cognition (following the failed OpenAI acquisition), has shipped a new feature called Codemaps.

The idea is to significantly ease codebase understanding. This actually looks incredibly useful, especially when tackling an existing codebase, say, an open-source project, and it might get me to switch over from Cursor.

Source

LLMs vs. Stack Overflow

Did you know about stackoverflow.ai? I must’ve completely missed this. It looks like a great alternative to the search function on the site (or using Google to search it). We seem to have come a full circle from LLMs killing StackOverflow to LLMs powering StackOverflow for search and discovery. Recommended.

Back to Causal Book: Regression Discontinuity

The intro sections and DAGs for the RD chapter are in. More to come.

I’m looking for interesting datasets for the RD design. I have some candidates, but I’m eager to find more compelling, real data. Ideally, I’d like a business case (rather than policy), such as one on customer loyalty status. The IV chapter already uses policy data (tax on cigarette prices vs. smoking). Please comment with a link if you have ideas beyond the Kaggle datasets.

As a reminder, Causal Book is an accessible, interactive resource for the data science and causal inference audience. It is not meant to substitute for the excellent texts already available, such as The Effect by Nick Huntington-Klein and The Mixtape by Scott Cunningham. This book aims to complement them by focusing on the idea of solution patterns, with code in R and Python, exploring different approaches (Freq. Statistics, Machine Learning, and Bayesian), and clarifying some of the counterintuitive (or seemingly surprising) challenges faced in practice.

Causal Book

Is college old school now?

This is interesting: Palantir has launched a “Meritocracy Fellowship” to hire high-achieving high school graduates right out of school, offering a paid internship with a chance at full-time employment. The company presents this as an alternative to college.

This is a very limited, transactional view of college. College is more than just training for employment; it is where students gain knowledge and broaden their horizons, learning how to think and ask questions, in addition to acquiring practical skills. I doubt a four-week history seminar will make up for all that.

Source

Neo the household robot

I’m terribly sad to learn that the first consumer humanoid robot marketed to load the dishwasher (finally!) is essentially a proxy operated remotely by a human (oh no). The automation it offers is akin to hiring a teenager to mow your lawn remotely, yet it introduces privacy and latency nightmares.

How much longer must we keep loading the dishes? Until Nvidia’s valuation hits $10 trillion? Let’s buy more stonks. I’m losing my patience here.

Source – Neo Order Page

Is our society increasingly rewarding conformity?

Is our society increasingly rewarding conformity? Is AI accelerating this process, and is it simultaneously stripping work of deep meaning? After all, thanks to LLMs, many now define creativity as merely a probabilistic recombination of matrices derived from a training set.

Is science also contributing to this potential lack of deviation in culture, education, arts, architecture, and business? Here’s a take on it (not mine):

You can spot this scientific bland-ification right away when you read older scientific writing. As Roger’s Bacon points out, scientific papers used to have style. Now they all sound the same, and they’re all boring.

Maybe science is supposed to be boring? What happened to the style though?

For definitive answers to these questions, look elsewhere. For a compelling set of data (plus plenty of causal speculation) on many aspects of contemporary society and scientific style, check out this compilation and the essay here.

The greatest thinkers in science (and business) are often prolific authors. They write books, blogs, and copious emails to sharpen ideas. Richard Lewontin, E.O. Wilson, and Paul Graham are but three examples. Dorothy Hodgkin’s scientific correspondence and papers, stacked together, extend 25.85 meters in length. Great thinkers, in other words, write all the time.

Researchers are evaluated by simple measures of productivity or influence — number of papers published, citation count, and grant dollars. In such an environment, it has become exceedingly difficult for scientists to take stylistic risks in their academic writing or to devote significant amounts of time to other forms of creative writing.

When is TSLS Actually LATE?

I first came across this paper while writing the Machine Learning Using IV chapter of the Causal Book. Revisiting it today, I remain struck by its central finding: about 95% of the empirical TSLS (Two-Stage Least Squares) models surveyed here claim to estimate the Local Average Treatment Effect (LATE), but they fail to meet the necessary conditions to do so.

The failure is mainly due to not controlling for covariates nonparametrically. That is to say, in attempting to correct for selection bias (endogeneity) using IVs, causal modelers inadvertently introduce significant specification bias, thereby theoretically nullifying the LATE interpretation.

On a different note, I’ve resumed work on Causal Book. Updates are on the way!

Is AI also innocent until proven guilty?

Today, my feed is full of speculation linking the recent AWS layoffs, driven by increased AI automation, to yesterday’s outage. In reality, we don’t really know if AI caused any of it.

What do we know? I read two articles this morning, and one thing that struck me is that AWS was reportedly not able to diagnose the core issue for 75–90 mins. That’s an absurdly long time.

If this timeline is accurate, the extended delay is compelling evidence that critical expertise was either absent or inaccessible when it was most needed, for whatever reason.

Credit for the image goes to Emil Lendof/WSJ.

Source 1Source 2

Update on using LLMs for OCR

Here’s an update on using LLMs for OCR without having to use the same hammer (generic model) for all nails. DeepSeek has released an OCR-focused model: https://github.com/deepseek-ai/DeepSeek-OCR

Check out the deep parsing mode, which is parsing images within documents through secondary model calls. Very useful for data extraction. The results are pretty impressive too:

Our work represents an initial exploration into the boundaries of vision-text compression, investigating how many vision tokens are required to decode 𝑁 text tokens. The preliminary results are encouraging: DeepSeek-OCR achieves near-lossless OCR compression at approximately 10× ratios, while 20× compression still retains 60% accuracy. These findings suggest promising directions for future applications, such as implementing optical processing for dialogue histories beyond 𝑘 rounds in multi-turn conversations to achieve 10× compression efficiency.