Data Science for Economists
2026-07-01
By the end of today you should be able to:
ellmer package) for classification, extraction, and annotation tasks.Motivation
Economic upside
Better text representations often improve predictive power (e.g. central-bank tone \(\to\) yields) and enable causal designs that exploit semantic shifts (e.g. narrative shocks).
From counts to dense vectors
Fixes on top of BoW (topic models, n-grams, dependency parsing) help but remain brittle, high-dimensional, and context-insensitive.
“You shall know a word by the company it keeps.” – J. R. Firth
Key idea
Move beyond which words occur to where words live in a low-dimensional space. Build a co-occurrence matrix and factorise it so that similar words sit close together.
Source: S. Wolfram, What Is ChatGPT Doing…? (writings.stephenwolfram.com, 2023)
Other approaches
LSA (PCA on DTM), pLSA (probabilistic LSA), NMF (non-negative matrix factorisation) all share the same goal: reduce dimensionality from \(V\) (vocab size) to \(K\) (topic count). LDA adds Dirichlet priors and is the most widely adopted.
Transformers and Attention
Strip away the hype and every LLM does one thing: given the text so far, predict the next token — then append it and repeat.
. . .
“What ChatGPT is always fundamentally trying to do is produce a reasonable continuation of whatever text it’s got so far.” — Stephen Wolfram
Source: 0xkato, How LLMs Actually Work (0xkato.xyz)
Ask a model to continue *“The best thing about AI is its ability to ___“* and it returns a probability for every word in its vocabulary:
Ranked probabilities fall off as a power law — a few plausible words, then a long tail.
Source: S. Wolfram, What Is ChatGPT Doing…? (writings.stephenwolfram.com, 2023)
Source: S. Wolfram, What Is ChatGPT Doing…? (writings.stephenwolfram.com, 2023)