Introduction#

irtlib is a Python package for item response theory (IRT), the models that relate an examinee’s responses to the items of a test to the examinee’s ability and to the items’ parameters. It calibrates items, estimating their parameters from the responses of a sample of examinees; it estimates the abilities of examinees from their responses to calibrated items; and it checks how well a calibration fits the responses. This page introduces the models and the methods, and ends with a map of irtlib’s parts. Terms and Notation lists the terms and symbols these pages use.

What a Test Measures#

A test measures an examinee’s ability, written \(\theta\): a characteristic that cannot be observed directly, such as knowledge of a subject. What can be observed are the examinee’s responses to the test’s items, each scored correct or incorrect, and item response theory infers the ability from them as a number on a continuous scale.

The responses of a sample of examinees form a response matrix, with one row per examinee and one column per item. It holds 1 for a correct response, 0 for an incorrect one, and NaN where the examinee did not answer the item, as when examinees take forms of a test that share only some of their items. With \(N\) examinees and \(M\) items, \(u_{ij}\) is examinee \(j\)’s response to item \(i\).

The Logistic Models#

Under the four-parameter logistic model (4PL), an examinee of ability \(\theta\) answers item \(i\) correctly with probability

\[P_i(\theta) = c_i + \frac{d_i - c_i}{1 + e^{-a_i(\theta - b_i)}}\]

[Magis, 2013, p. 306, Equation 1], the item’s characteristic curve. Its four parameters shape the curve:

  • the discrimination \(a_i\), its slope: how sharply the item separates examinees of lower and higher ability;

  • the difficulty \(b_i\), the ability at which the curve is steepest, on the same scale as \(\theta\);

  • the guessing parameter \(c_i\), the curve’s lower asymptote: the probability that an examinee of very low ability answers the item correctly;

  • the upper asymptote \(d_i\): the probability that an examinee of very high ability answers the item correctly, below 1 for an item that such examinees still miss [Barton and Lord, 1981, p. 2].

The three-parameter model (3PL) fixes every \(d_i = 1\), the two-parameter model (2PL) also every \(c_i = 0\), and the one-parameter model (1PL) also gives every item the same discrimination; the Rasch model is the 1PL with every discrimination equal to 1 [Magis and Raîche, 2012, p. 3]. irtlib writes the models without the scaling constant \(D\) that some sources and programs multiply each \(a_i\) by (ADR-0001: irtlib Implements Item Response Theory for Unidimensional Dichotomous Items), and converts the parameters of items written with one (Item Response Functions).

Each response also carries information about the ability: the more information a test’s items give at an examinee’s ability, the smaller the standard error of the estimate made from their responses [Magis and Raîche, 2012, p. 4, Equation 3]. The formulas of these quantities are on the Item Response Functions page.

The ability scale has no natural origin or unit. Moving every ability and difficulty by one amount leaves every probability unchanged, and so does stretching the abilities and difficulties by one factor while the discriminations shrink by it: the scale is set only up to a linear transformation [Baker, 1987, p. 112]. Each calibration method fixes the scale in its own way, which its documentation states.

Calibration#

Calibration estimates the items’ parameters, with their standard errors, from a response matrix. The examinees’ abilities are unknown too, and the likelihood of the responses depends on them. The four methods irtlib implements differ in what they do with the abilities.

Joint maximum likelihood treats each examinee’s ability as one more parameter and maximizes the likelihood of the responses over the abilities and the item parameters together, with no assumption about how abilities are distributed in the population [Baker, 1987, p. 112]. Each examinee adds a parameter, so the number of parameters grows with the sample [Bock and Aitkin, 1981, p. 443]: for the Rasch model, as examinees are added to a test of fixed length, the difficulty estimates converge to limits that differ from the difficulties by a term of order \(1/M\) [Haberman, 2004, p. 13]. Haberman (p. 35) finds it “difficult to advocate use of JMLE except for preliminary estimation of parameters”. An examinee who answers every item correctly, or none, has no finite ability estimate, and an item answered correctly by every examinee or by none has no finite difficulty, so both are left out before estimation [Wright and Douglas, 1977, p. 294]. irtlib calibrates the Rasch model and the 2PL this way (irtlib.jml).

Conditional maximum likelihood applies to the Rasch model alone. There, an examinee’s number of correct responses is a sufficient statistic for its ability, so the likelihood of the responses given each examinee’s number correct holds the item difficulties alone, and “does not depend on the distribution function” of ability [Haberman, 2004, p. 35]. No such statistic eliminates the ability from the likelihood of the other models [Bock and Aitkin, 1981, p. 443]. The estimates are consistent as the number of examinees grows [Andersen, 1970, p. 286, Theorem 1] (irtlib.cml).

Marginal maximum likelihood integrates the abilities out over a population distribution and maximizes the likelihood of the item parameters alone, and Bock and Aitkin’s EM algorithm makes it feasible for any number of items, with one small problem per item in each cycle [Bock and Aitkin, 1981, pp. 444, 447]. The integral becomes a sum over the nodes of a quadrature grid [Bock and Aitkin, 1981, p. 445]. Under the 3PL, different triples \((a_i, b_i, c_i)\) can trace similar curves where the examinees are, so that the likelihood is “nearly flat along one or more dimensions” [Mislevy, 1986, p. 189]. Priors on the item parameters then make the estimates Bayes modal: they maximize the likelihood times the prior, and the EM algorithm carries over [Mislevy, 1986, p. 182]. irtlib calibrates the 1PL to the 4PL this way, with or without priors, and takes a response matrix with missing responses (irtlib.mml).

Markov chain Monte Carlo draws the abilities and the item parameters, in turn, from their joint posterior given the responses, under priors on all of them [Patz and Junker, 1999, p. 156]; [Kim and Bolt, 2007, p. 40]. The draws of the items alone, the abilities left aside, behave asymptotically as marginal maximum likelihood’s estimates do [Patz and Junker, 1999, pp. 151-152], and their mean and standard deviation serve as the estimate and its standard error [Kim and Bolt, 2007, p. 46]. Several chains of draws run from dispersed starting values, and calibration checks that they agree [Gelman and Rubin, 1992, p. 461]. It costs far more than marginal maximum likelihood, and gives the whole posterior of each item rather than its mode. irtlib calibrates the 1PL to the 3PL this way, and also takes missing responses (irtlib.mcmc).

Ability Estimation#

With the items calibrated, each examinee’s ability is estimated from its responses, with a standard error. irtlib has four estimators (irtlib.ability):

  • the maximum likelihood (ML) estimate maximizes the likelihood of the responses, and its standard error is the inverse square root of the test information [Magis and Raîche, 2012, p. 4, Equations 2 and 3]. Responses all correct give an estimate of \(+\infty\), and responses all incorrect one of \(-\infty\) [Warm, 1989, p. 442];

  • the maximum a posteriori (MAP), or Bayes modal, estimate maximizes the posterior, the likelihood times a prior density of ability [Magis and Raîche, 2012, p. 5, Equation 5];

  • the expected a posteriori (EAP) estimate is the mean of the posterior, and its standard error is the posterior standard deviation [Bock and Mislevy, 1982, p. 433];

  • Warm’s weighted likelihood (WLE) estimate removes the first-order bias of the maximum likelihood estimate [Warm, 1989, p. 427].

A test scored by its number correct reports one estimate per number correct, the mean of the posterior given the number correct alone, which every examinee with that number shares [Thissen et al., 1995, p. 40] (EAP by Number Correct).

Checking a Calibration#

Before a calibration, two classical item statistics screen the responses with no model: each item’s proportion correct [Wright and Stone, 1979, p. 25], and its correlation with the examinees’ scores on the other items [Baker, 1987, p. 123] (irtlib.classical).

Item fit compares, item by item, the responses a calibration predicts with those observed (irtlib.fit). Orlando and Thissen’s S-X² groups examinees by their number-correct score, which is observed, rather than by an ability estimate, whose groups depend on the model [Orlando and Thissen, 2000, p. 52]; it applies to every model. The weighted and unweighted mean squares of the Rasch model compare each response with its expectation at the examinee’s estimated ability [Wright and Masters, 1982, pp. 97-99].

A model with more parameters always fits at least as well, and model comparison asks whether the improvement outweighs the parameters spent (irtlib.comparison): the likelihood-ratio test of nested models [Orlando and Thissen, 2000, p. 51], the information criteria AIC [Akaike, 1974, p. 719] and BIC [Schwarz, 1978, p. 461], and \(G^2\), which compares the model with the general multinomial over response patterns [Bock and Aitkin, 1981, p. 450]. BIC selects the true model as the sample grows when it is among the candidates, and AIC does not; AIC is efficient when no candidate is true [Vrieze, 2012, Pages 10-11].

irtlib’s Parts#

References#

[Aka74]

Hirotugu Akaike. A new look at the statistical model identification. IEEE Transactions on Automatic Control, 19(6):716–723, 1974. Not openly available; Vrieze (2012) describes the criterion. doi:10.1109/TAC.1974.1100705.

[And70]

Erling B. Andersen. Asymptotic properties of conditional maximum-likelihood estimators. Journal of the Royal Statistical Society: Series B (Methodological), 32(2):283–301, 1970. Not openly available; Haberman (2004) describes conditional estimation. doi:10.1111/j.2517-6161.1970.tb00842.x.

[Bak87] (1,2,3)

Frank B. Baker. Methodology review: item parameter estimation under the one-, two-, and three-parameter logistic models. Applied Psychological Measurement, 11(2):111–141, 1987. Open copy: https://hdl.handle.net/11299/103398. doi:10.1177/014662168701100201.

[BL81]

Mark A. Barton and Frederic M. Lord. An upper asymptote for the three-parameter logistic item-response model. Research Report RR-81-20, Educational Testing Service, Princeton, NJ, 1981. Open copy: https://files.eric.ed.gov/fulltext/ED207996.pdf. doi:10.1002/j.2333-8504.1981.tb01255.x.

[BA81] (1,2,3,4,5)

R. Darrell Bock and Murray Aitkin. Marginal maximum likelihood estimation of item parameters: application of an EM algorithm. Psychometrika, 46(4):443–459, 1981. Not openly available; Baker (1987) describes the method. doi:10.1007/BF02293801.

[BM82]

R. Darrell Bock and Robert J. Mislevy. Adaptive EAP estimation of ability in a microcomputer environment. Applied Psychological Measurement, 6(4):431–444, 1982. Open copy: http://purl.umn.edu/93227. doi:10.1177/014662168200600405.

[GR92]

Andrew Gelman and Donald B. Rubin. Inference from iterative simulation using multiple sequences. Statistical Science, 7(4):457–472, 1992. Open copy: https://sites.stat.columbia.edu/gelman/research/published/itsim.pdf. doi:10.1214/ss/1177011136.

[Hab04] (1,2)

Shelby J. Haberman. Joint and conditional maximum likelihood estimation for the Rasch model for binary responses. Research Report RR-04-20, Educational Testing Service, Princeton, NJ, 2004. Open copy: https://files.eric.ed.gov/fulltext/EJ1110899.pdf. doi:10.1002/j.2333-8504.2004.tb01947.x.

[KB07] (1,2)

Jee-Seon Kim and Daniel M. Bolt. Estimating item response theory models using Markov chain Monte Carlo methods. Educational Measurement: Issues and Practice, 26(4):38–51, 2007. Open copy: https://www.ncme.org/wp-content/uploads/2025/10/Module-27-Markov-chain-Monte-Carlo-Estimation-Kim-1.pdf. doi:10.1111/j.1745-3992.2007.00107.x.

[Mag13]

David Magis. A note on the item information function of the four-parameter logistic model. Applied Psychological Measurement, 37(4):304–315, 2013. Not openly available; Magis and Raîche (2012) describe the model and its information function. doi:10.1177/0146621613475471.

[MRaiche12] (1,2,3,4)

David Magis and Gilles Raîche. Random generation of response patterns under computerized adaptive testing with the R package catR. Journal of Statistical Software, 48(8):1–31, 2012. Open access. doi:10.18637/jss.v048.i08.

[Mis86] (1,2)

Robert J. Mislevy. Bayes modal estimation in item response models. Psychometrika, 51(2):177–195, 1986. Not openly available; Harwell and Baker (1991) describe the method. doi:10.1007/BF02293979.

[OT00] (1,2)

Maria Orlando and David Thissen. Likelihood-based item-fit indices for dichotomous item response theory models. Applied Psychological Measurement, 24(1):50–64, 2000. Not openly available; Kang and Chen (2007) describe the method. doi:10.1177/01466216000241003.

[PJ99] (1,2)

Richard J. Patz and Brian W. Junker. A straightforward approach to Markov chain Monte Carlo methods for item response models. Journal of Educational and Behavioral Statistics, 24(2):146–178, 1999. Not openly available; Kim and Bolt (2007) describe the method. doi:10.3102/10769986024002146.

[Sch78]

Gideon Schwarz. Estimating the dimension of a model. The Annals of Statistics, 6(2):461–464, 1978. Open copy: https://projecteuclid.org/journals/annals-of-statistics/volume-6/issue-2/Estimating-the-Dimension-of-a-Model/10.1214/aos/1176344136.pdf. doi:10.1214/aos/1176344136.

[TPBW95]

David Thissen, Mary Pommerich, Kathleen Billeaud, and Valerie S. L. Williams. Item response theory for scores on tests including polytomous items with ordered responses. Applied Psychological Measurement, 19(1):39–49, 1995. Open copy: https://hdl.handle.net/11299/117418. doi:10.1177/014662169501900105.

[Vri12]

Scott I. Vrieze. Model selection and psychological theory: a discussion of the differences between the Akaike information criterion (AIC) and the Bayesian information criterion (BIC). Psychological Methods, 17(2):228–243, 2012. Open copy (author manuscript): https://pmc.ncbi.nlm.nih.gov/articles/PMC3366160/. doi:10.1037/a0027127.

[War89] (1,2)

Thomas A. Warm. Weighted likelihood estimation of ability in item response theory. Psychometrika, 54(3):427–450, 1989. Not openly available; Warm's (1985) dissertation, https://hdl.handle.net/11244/5356, derives the same results. doi:10.1007/BF02294627.

[WD77]

Benjamin D. Wright and Graham A. Douglas. Best procedures for sample-free item analysis. Applied Psychological Measurement, 1(2):281–295, 1977. Open copy: https://hdl.handle.net/11299/98553. doi:10.1177/014662167700100216.

[WM82]

Benjamin D. Wright and Geoffrey N. Masters. Rating Scale Analysis. MESA Press, Chicago, 1982. Open copy: https://www.rasch.org/BTD_RSA/pdf/Rating%20Scale%20Analysis.pdf.

[WS79]

Benjamin D. Wright and Mark H. Stone. Best Test Design. MESA Press, Chicago, 1979. Open copy: https://www.rasch.org/BTD_RSA/pdf/Best%20Test%20Design.pdf.