← All examples

Item Response Theory

A test score is a summary; item response theory is a model of how that score came about. It is the core of modern psychometrics — the measurement branch of psychology and education, which deals with quantities nobody can observe directly (ability, attitude, symptom severity) and has to infer them from how people answer a set of questions. Its defining difficulty is that the questions are part of the instrument: a low score can mean a weak trait or a hard set of items, and the two are only separable with a model that carries both at once. Every person carries a latent trait, every item has a curve giving the probability of a given response as a function of that trait, and the two are estimated on one common scale — which is what lets a hard item and a high-ability examinee be compared at all. The arc builds outward from the simplest case: dichotomous items (2PL and 3PL, with Rasch folded in as the equal-discrimination special case), then ordered responses for Likert data, then multiple traits, where IRT turns out to be factor analysis for categorical items. From there it becomes diagnostic — separating impact (do the groups differ in the trait?) from bias (does an item behave differently at the same trait level?), which is the statistical machinery behind test fairness, and turning the question around to ask what makes an item hard in the first place. It closes by asking how to choose among the models it has built — and by getting the likelihood right first, since scoring an IRT model on the wrong unit reports 278 effective parameters for one that has six.

The from-scratch engine throughout is Albert–Chib data augmentation, which is fitting: the 1992 paper that introduced that trick introduced it for IRT, before it spread to probit, Tobit and multivariate probit models elsewhere in this collection. Working psychometrically also means confronting how much of a reported number is convention rather than result — the same item can carry two legitimate discrimination values depending on whether the model is written in the normal-ogive or logistic metric, a loading table can look unrelated to a discrimination table that it exactly equals, and a guessing parameter can be quoted to two decimals from a fit that never converged. Running two independent implementations of every model is what makes those distinctions visible rather than leaving them as apparent disagreements.

What an item characteristic curve is. Every model in this section is a variation on one object, so it is worth drawing in words first. Put ability on the horizontal axis and the probability of a correct or endorsing response on the vertical, and an item traces an S-shaped curve between them: low-ability people rarely get it, high-ability people usually do, and the interesting part is the transition. Three numbers describe that curve and each answers a different question. Difficulty is where the transition happens — the ability at which a person has a 50% chance — and because it is measured on the ability scale, an item and a person can be compared directly, which is the whole point. Discrimination is how steeply it happens: a steep item separates people either side of it sharply but says little about anyone far away, while a shallow item grades everybody coarsely. Guessing is where the curve bottoms out — on a five-option multiple-choice item it should be near 1 in 5, because even someone who knows nothing will sometimes tick the right box. The models below add these one at a time (1PL, 2PL, 3PL), then let the curve describe an ordered response rather than a right/wrong one, then give it a second ability axis, then ask whether it sits in the same place for two groups.

What a total score cannot do. Counting right answers works only as long as everyone answered the same questions. The moment two people face different items — different test forms, an adaptive test that chose questions as it went, a scale revised between waves — their totals are not comparable, because a low score might mean a weak trait or a hard set of items and the total cannot tell them apart. Estimating people and items on one scale is what dissolves that: an ability estimate is adjusted for the difficulty of the items actually taken, so two examinees with no questions in common can still be placed on the same axis. That is why item response theory underpins adaptive testing and test equating, and it is the practical payoff for all the machinery that follows. A related consequence runs the other way: because the scale is fixed by convention (ability is given mean 0 and variance 1 in the sample), an ability of +1 means one standard deviation above these respondents and nothing absolute. What is real is the ordering and the distances, not the zero point.

Where a test measures, and where it does not. A test does not have one accuracy; it has a different accuracy at every level of the trait. Information measures that — how sharply the responses pin down ability at a given point — and it is largest where an item’s curve is steepest, which is near its own difficulty. Its inverse square root is the standard error of the ability estimate, so more information means a tighter estimate, and a test measures precisely only in the range where its items are pitched. Two consequences show up repeatedly below. A test whose items are all easy, like the LSAT section used here, measures somewhat-below-average ability well and is blunt for the strongest candidates — the very people a selection test most needs to separate. And modelling guessing honestly lowers the measured precision rather than raising it, because a correct answer that might have been a lucky guess carries less evidence about ability than the 2PL assumes it does.

How the models get compared. More parameters always fit the data in hand better, so the closing question is out-of-sample: would the extra parameters improve prediction for someone new? WAIC and PSIS-LOO estimate that, reporting an elpd — roughly, the log-probability the model would assign to data it has not seen — minus a penalty for effective complexity. Only differences between models on the same data mean anything, and each difference comes with a standard error, so a gap of a couple of standard errors is not evidence. The subtlety that opens the comparison is what counts as one observation. Scoring response-by-response treats each person’s ability as a parameter and the penalty counts all of them — reporting 278 effective parameters for a model with six. Integrating ability out makes the person the unit, and the penalty falls to 6.5, which is what the model really costs.

A continuous trait, or a set of types? Everything here assumes the latent variable is continuous — ability, neuroticism and aggression are quantities you can have more or less of, and the models give each person a position on a smooth scale, conventionally standard normal. That assumption is doing real work and it is not the only option. Latent class analysis asks the same question of the same kind of data — several categorical responses, one unobserved cause behind them — but takes the latent variable to be discrete and unordered: a finite set of classes, with each respondent belonging to one and each class having its own response probabilities. The two are the same idea about measurement with different commitments about what is being measured. Ask how much and you want a trait model; ask which kind and you want classes. The choice is substantive rather than technical, and it is testable: a genuinely graded trait fitted with classes needs more and more of them to approximate the continuum, while genuinely distinct types fitted on one dimension show up as items that refuse to order consistently. Between the two sit the hybrids — ordered classes, or a continuous trait within each class — which is why the distinction is worth stating explicitly rather than letting the choice of software make it.

One curve, four variations — and where the test actually measures

Every panel is drawn from the fitted parameters the notebooks below publish, not from illustrative values. A and E are the LSAT 2PL, B the SAT12 3PL, C the neuroticism graded model and D the verbal-aggression DIF model. The SAT12 item in B is the one whose fitted floor is closest to the 32-item average, so it is a typical item rather than the most striking one.

A · Five LSAT items — every difficulty below average ability θ P(correct) -4 -2 0 2 4 0.0 0.5 1.0 easiest b = -3.67 hardest b = -0.29 even the hardest sits below average ability B · SAT12 item 1 — the 2PL sends the tail to zero ability θ P(correct) -4 -2 0 2 4 0.0 0.5 1.0 c = 0.19 — chance alone 2PL — no floor 3PL — floor fitted C · 'angers easily' (a = 1.74) — a curve per response option neuroticism θ P(category) 1 2 3 4 5 6 -4 -2 0 2 4 0.0 0.5 1.0 D · 'S2WantShout' — same trait level, different curve verbal aggression θ P(endorse) δ/a = 0.67 on the trait scale δ = +0.59 on the latent scale -4 -2 0 2 4 0.0 0.5 1.0 women men E · Where the LSAT measures — and where it does not ability θ test information -4 -2 0 2 4 0.0 0.2 0.4 0.6 most information at θ = -1.6 SE = 1, the population SD 0 1 2 3 SE(θ) SE 1.35 SE 2.10 SE 2.91 even at its best the error exceeds the spread of the population it is measuring

Read across the top row and the model is being extended one assumption at a time. A is the object itself: five curves, each crossing 50% at its own difficulty, and every one of those crossings lies left of average ability — this section of the LSAT is easy for the people who sat it. B adds the floor a multiple-choice item needs: below about −1 the two models disagree completely, the 2PL insisting that a weak examinee is nearly certain to be wrong while the 3PL concedes the 1-in-5 that chance alone supplies. C replaces right/wrong with six ordered options, each owning a stretch of the trait. D draws one item twice, once per group: the horizontal gap is what differential item functioning is, and stating it as δ/a puts it in trait units — men reach even odds of endorsing this item about two-thirds of a standard deviation lower down the scale than women do.

E is the panel worth dwelling on, because it is the one a total score cannot produce at all. Precision is not a property of the test, it is a function of where you stand: information peaks at θ = −1.6, which is where these easy items are pitched, and collapses toward the top of the range. The standard error runs the other way — 1.35 at its best, 2.10 at θ = +2, 2.89 at θ = +3. The comparison that makes those numbers concrete is the dotted line at 1.0: ability is scaled so the population has a standard deviation of one, so even where this five-item test measures best, its error is larger than the whole spread of the people it is measuring — and for the strongest candidates it is nearly three times that. Five items cannot rank anybody. That is an argument for longer tests and for adaptive item selection, and it is invisible in a total score, which reports the same apparent precision at every level.

How the five examples relate

One curve, extended in four directions. Start with the dichotomous foundation; each of the others changes exactly one thing about what the curve describes or what is asked of it.

Every one is fitted by the same engine — Albert–Chib data augmentation, which draws the latent response behind each answer and turns a nonlinear model into a sequence of linear ones. The 1992 paper that introduced it introduced it for this, before the trick spread to the probit, Tobit and multivariate probit models elsewhere in the collection.

2PL & 3PL — Dichotomous Foundations

The starting point: a curve per item, with a difficulty, a discrimination that says how sharply the item separates ability levels, and — for multiple choice — a guessing floor. Constraining the discriminations equal gives the Rasch model, and on the LSAT the data say that is enough (likelihood-ratio test p = 0.97). Fitted by Albert–Chib augmentation, which for the 3PL adds a latent "knows-it" indicator so a correct answer from a non-knower is treated as the guess it is. Two things are worth separating. The engines appear to disagree on discrimination by a factor of two — 0.37–0.51 against 0.66–0.89 — because one is normal-ogive and the other logistic, differing by the constant D = 1.702, which is easy to overlook; rescaled they agree to 0.05, while difficulty, being a ratio, is metric-free and already agreed at correlation 0.998. And the SAT12 guessing rates should not be quoted to two decimals from the classical fits at all: neither converged — ltm hits its iteration cap, mirt reports converged = FALSE — because the likelihood is nearly flat in the guessing parameter. The Bayesian version fits cleanly only because its Beta(1,4) prior supplies the curvature the likelihood lacks, which is why its posterior mean sits above the maximum-likelihood estimates rather than agreeing with them. On these data guessing is simply not pinned down.

View example →

Polytomous IRT — the Graded Response Model

Real questionnaires ask strongly disagree through strongly agree, and a 2PL has nowhere to put the middle. Samejima's graded response model is the ordered-probit answer: latent propensity cut by ordered thresholds, one category response curve per option, with two categories recovering the 2PL exactly. On a five-item neuroticism scale (2,694 respondents, six-point items) it ranks anger and irritation as the sharpest indicators and panic the bluntest, and mirt and ltm reproduce the item bank to three decimals. The from-scratch discriminations come out biased low on precisely the sharpest items — at a 3,000-draw chain, 16% and 19% below mirt while the three blunt ones sit within 3% — a pattern easy to read as agreement. Simulating at the data's exact dimensions with known parameters, over five independent datasets, isolated the cause: not the model but chain length. The order-constrained threshold update draws each cutpoint between adjacent order statistics that sit O(1/N) apart, so at N = 2694 the cutpoints crawl and the most spread-out items settle last. Four times the chain brings every simulated item within 2% of truth, cuts the threshold RMSE by a factor of 2.5, and closes the real-data gap to 4–11%.

View example →

Multidimensional IRT & the Factor-Analysis Bridge

Give each person a vector of traits and each item a vector of discriminations, and the model stops being only psychometrics: a discrimination vector is a factor loading, and multidimensional IRT is confirmatory item factor analysis. Fitted by Albert–Chib augmentation plus a parameter-expanded inverse-Wishart factor step, so the loadings and the factor correlation come out identified without a rotation. On two Big Five scales (2,617 respondents, ten binary items) extraversion and neuroticism correlate −0.29 [−0.35, −0.24] — the familiar modest E–N link, recovered from binary responses — and refitting five items alone as a one-factor model reproduces the loadings at r = 0.970, confirming the 2PL is the one-factor case. Two apparent disagreements are conventions, not results. The engines print loading tables that look unrelated — 0.82 against 0.63 for the same item — because one reports discriminations and the other standardised loadings; under λ = a/√(1+a²) they agree to 0.011 across all ten items. And psych's factor correlation of −0.22 against mirt's −0.30 isn't a disagreement about the data — psych is exploratory and its cross-loadings absorb between-factor covariance that confirmatory simple structure forces the correlation to carry.

View example →

Differential Item Functioning & Explanatory IRT

Where IRT becomes the machinery behind test fairness. Two questions must be kept apart: impact — do the groups differ in the trait? — and DIF — does an item behave differently at the same trait level? A group can genuinely differ and items can still be biased, so both are estimated together, and both fall out of the same augmentation. On the verbal-aggression data the split earns its keep: the overall gender difference is not distinguishable from zero (β = +0.22, CrI [−0.05, +0.50]) while five items function differentially, and the pattern is legible — women over-endorse a want-to-shout item, men over-endorse every do-curse and do-scold item. The genders differ less in how aggressive they are than in how it is expressed. One distinction does the work here: the items with the largest shifts are not the flagged set. Flagging asks whether an item's shift excludes zero, so a large but uncertain shift can go unflagged while a smaller, tightly-estimated one is caught — which means a ranking by size and a list of flagged items need not even have the same length. Reported properly, five items are flagged, and all four that R's independent difR analysis flags appear among them — two methods sharing no machinery landing on the same items. The sample is 73 men against 243 women, so most intervals are wide: the flagged set is the conservative end of what may be there, and an unflagged item is weak evidence of fairness rather than proof of it. A closing LLTM regression explains 88% of item difficulty from three design features.

View example →

Model Comparison — 1PL vs 2PL vs 3PL

The capstone: three nested models, and the question of whether the extra parameters earn their keep out of sample. It opens by getting the likelihood right — scoring an IRT model conditionally reports p_eff = 278.3 for a 1PL with six item parameters, because the penalty is swamped by the abilities; integrating ability out by Gauss–Hermite makes the person the unit and gives 6.5, which is exactly five easinesses plus a slope. Then the same criterion delivers opposite verdicts: on the near-Rasch LSAT parsimony wins (2PL − 1PL is −3.8 ± 1.3 elpd, and R's BIC, LRT and an RMSEA of 0.000 all agree), while on multiple-choice SAT12 guessing earns its keep (+42.0 ± 11.5). The classical criteria there disagree among themselves — AIC and the LRT pick the 3PL, BIC picks the 2PL — so the choice of penalty is the choice of model. Both classical fits there carry a caveat: mirt's SAT12 3PL reports converged = FALSE, so its AIC and BIC approximate quantities the optimiser never reached, and sampling the same model in PyMC produces 499 divergences out of 2,000 draws where the from-scratch Gibbs sampler produces none — the weakly-identified guessing parameter showing up in every engine that tries to estimate it without a prior.

View example →