Conditional Maximum Likelihood#
Motivation#
In the Rasch model 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]. Its maximizers, the conditional maximum likelihood (CML) estimates, are consistent as the number of examinees grows [Andersen, 1970, p. 286, Theorem 1], though “not in general … efficient” (p. 284).
Choose it to calibrate the Rasch model without assuming how abilities are distributed in the population. It needs complete responses; Marginal Maximum Likelihood calibrates the Rasch model on incomplete ones, under a normal population.
Definition#
Write \(\varepsilon_i = e^{-b_i}\) for item \(i\)’s easiness, the item parameter of Gustafsson’s multiplicative form of the model [Gustafsson, 1980, p. 379, Equation 1], \(s_i\) for its number of correct responses and \(n_r\) for the number of examinees with \(r\) correct, out of \(M\) items. The conditional likelihood is
where the elementary symmetric function \(\gamma_r\) is the sum, over every set of \(r\) items, of the product of their easiness values (p. 379, Equations 5 and 6). Its logarithm, the conditional log-likelihood, is \(-\sum_i s_i b_i - \sum_r n_r \log \gamma_r\); the marginal log-likelihood adds to it the log-likelihood of the numbers correct [Haberman, 2004, pp. 35-36], so the two are not compared (ADR-0006).
The estimates solve the likelihood equations
where \(\gamma_{r-1}^{(i)}\), the derivative of \(\gamma_r\) with respect to \(\varepsilon_i\), is the symmetric function of order \(r - 1\) of every item but \(i\) [Gustafsson, 1980, p. 380, Equation 7], and \(\pi_{ri}\) is the probability of a correct response to item \(i\) given \(r\) correct [Haberman, 2004, pp. 15-16]. The difficulties are identified by summing to zero (ADR-0008), as Andersen [1972, p. 45] identifies them; Gustafsson [1980, p. 380] sets one easiness to 1 instead.
Implementation#
Examinees and items left out. For an examinee with no item or every item correct, “both sides are equal to one” in the conditional likelihood [Engelen, 1987, p. 11], and items answered correctly by every examinee or by none have no estimate [Gustafsson, 1980, p. 379]: both are left out, the examinees first and then the items, repeatedly until neither is left, since leaving an item out can leave an examinee with no item or every item correct. The items left out get no estimate.
Likelihoods with no maximum. Even then the conditional likelihood can lack a maximum. It has none exactly when, for some number correct between 1 and \(M - 2\) and some cut of the item totals, the examinees with at most that many correct answered no item below the cut and the others every item above it [Haberman, 2004, pp. 37-38, Theorem 10], whose bounds on the item totals, \(n_0\) and \(n - n_0\), are 0 and \(n\) once the examinees are left out. The likelihood then rises without bound as the two groups of items move apart, so that under the sum to zero no difficulty has a finite estimate, and calibration raises an error naming the groups.
Newton-Raphson. The equations are solved by Newton-Raphson [Haberman, 2004, p. 43]. The gradient of the conditional log-likelihood with respect to \(b_i\) is \(\sum_r n_r \pi_{ri} - s_i\), and its Hessian is \(-V\), where \(V_{ij} = \sum_{r=1}^{M-1} n_r v_{rij}\) is the conditional covariance of the item scores given the numbers correct (p. 39), with \(v_{rii} = \pi_{ri} - \pi_{ri}^2\) and, for \(i \neq j\), \(v_{rij} = \pi_{rij} - \pi_{ri} \pi_{rj}\) (pp. 27-28, 43). Here \(\pi_{rij} = \varepsilon_i \varepsilon_j \gamma_{r-2}^{(i,j)} / \gamma_r\), the probability of correct responses to both items, where \(\gamma_{r-2}^{(i,j)}\), the second derivative of \(\gamma_r\) with respect to \(\varepsilon_i\) and \(\varepsilon_j\), is the symmetric function of order \(r - 2\) of every item but \(i\) and \(j\) [Gustafsson, 1980, p. 380]. \(V\) has rank \(M - 1\) [Haberman, 2004, p. 39], so a step solves the system in its Moore-Penrose inverse \(V^+\): Haberman’s iteration sets the first difficulty to 0 through a matrix \(K\) (pp. 26, 43), and for difficulties that sum to zero, the centred parameters of p. 21, it reads \(b_{t+1} = b_t + V^+ (\sum_r n_r \pi_r - s)\).
Step halving, a departure. Each step is halved, up to 30 times, until the conditional log-likelihood does not fall, which the sources do not do: from the starting values below, full steps diverged on two items answered 11 to 1.
Starting values and stopping. The iterations start from the values of Andersen [1972, p. 52, Equation 40], \(b_i = \log((N - s_i) / s_i)\) centred to sum to zero, computed over the \(N\) examinees kept where Andersen counts every examinee. They stop when no difficulty changes by more than the tolerance in an iteration [Haberman, 2004, p. 44], counting only a full step: a step that halving shrank below the tolerance can lie far from the maximum. Without extreme items, Newton-Raphson usually takes 4 to 5 iterations [Gustafsson, 1980, p. 383]. The result holds the conditional log-likelihood after each iteration, which the halving keeps from falling beyond rounding.
The symmetric functions. They come from the summation algorithm, which adds one item at a time, \(\gamma_r(\varepsilon_1, \dots, \varepsilon_t) = \gamma_r(\varepsilon_1, \dots, \varepsilon_{t-1}) + \varepsilon_t \gamma_{r-1}(\varepsilon_1, \dots, \varepsilon_{t-1})\) from \(\gamma_0 = 1\), with no subtraction, so that it stays accurate on long tests [Gustafsson, 1980, p. 381, Equation 10]. Run with an item’s easiness, or a pair’s, set to zero, it gives the first and second derivatives [Gustafsson, 1980, p. 382]; [Baker and Harwell, 1996, pp. 182-183], so that an iteration costs a number of operations growing as \(M^4\) [Baker and Harwell, 1996, p. 190]. The recursion runs on the logarithms of the functions, which departs from the sources: those of orders near \(M/2\) grow with the test until they reach “the limit set by the size of the floating point numbers” [Gustafsson, 1980, p. 383].
Standard errors. The variance of each difficulty is the diagonal of \(V^+\) at the estimates, and its standard error the square root; with the slopes and asymptotes fixed, each item’s covariances hold that variance alone. Haberman [2004, p. 40] takes the covariance from \(K V^- K^T\) for the first difficulty set to 0; for difficulties that sum to zero, centring that covariance gives \(V^+\). Andersen [1972, p. 50] estimates the covariance by the inverse of the information as well.
Complete responses. CML needs complete responses: for responses missing at random, “ordinary
CML” “will likely fail” [Robitzsch, 2021, p. 827], and MMLCalibrator
calibrates incomplete responses (ADR-0006).
Parameters#
Parameter |
Default |
Description |
Default from |
|---|---|---|---|
|
|
The stopping rule: the largest change of a difficulty in a full Newton-Raphson step. |
Haberman [2004, p. 44] |
|
|
The most Newton-Raphson iterations before the calibration stops unconverged. |
irtlib; no source yet (sources wanted) |
Guarantees#
The difficulties of the items estimated sum to zero.
Examinees with no item or every item correct, and items answered correctly by every examinee or by none, are left out, repeatedly until neither is left; the items left out have NaN estimates.
Responses whose conditional likelihood has no maximum raise an error naming the two groups of items.
A missing response raises an error that names
MMLCalibratoras the alternative.
References#
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.
Erling B. Andersen. The numerical solution of a set of conditional estimation equations. Journal of the Royal Statistical Society: Series B (Methodological), 34(1):42–54, 1972. Not openly available; Haberman (2004) describes the Newton-Raphson solution. doi:10.1111/j.2517-6161.1972.tb00887.x.
Frank B. Baker and Michael R. Harwell. Computing elementary symmetric functions and their derivatives: a didactic. Applied Psychological Measurement, 20(2):169–192, 1996. Open copy: https://hdl.handle.net/11299/119090. doi:10.1177/014662169602000206.
R. J. H. Engelen. A review of different estimation procedures in the Rasch model. Research Report 87-6, University of Twente, Department of Education, Enschede, 1987. Open copy: https://files.eric.ed.gov/fulltext/ED310126.pdf.
Jan-Eric Gustafsson. A solution of the conditional estimation problem for long tests in the Rasch model for dichotomous items. Educational and Psychological Measurement, 40(2):377–385, 1980. Not openly available; Baker and Harwell (1996) describe the method. doi:10.1177/001316448004000214.
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.
Alexander Robitzsch. A comprehensive simulation study of estimation methods for the Rasch model. Stats, 4(4):814–836, 2021. Open access. doi:10.3390/stats4040048.
API Reference#
Conditional maximum likelihood calibration of the Rasch model.
- class irtlib.cml.CMLCalibrator(*, tolerance: float = 1e-05, max_cycles: int = 100)[source]#
Calibrate the Rasch model by conditional maximum likelihood.
Each call to
calibrate()estimates the difficulties of the items of one complete response matrix, with every slope 1, from the likelihood of the responses given each examinee’s number correct, whatever the distribution of ability. The difficulties sum to zero.The Conditional Maximum Likelihood page gives the method, its sources and the origin of each default.
- Parameters:
- tolerancefloat, optional
The stopping rule: calibration stops when no difficulty changes by more than this in an iteration. Default is 1e-5.
- max_cyclesint, optional
The most iterations a calibration runs before it stops unconverged. Default is 100.
- Raises:
- ValueError
If
toleranceis not positive, ormax_cyclesis less than 1.
Examples
>>> import numpy >>> responses = numpy.array([[1, 0], [1, 0], [0, 1], [1, 1], [0, 0]], dtype=float) >>> calibration = CMLCalibrator().calibrate(responses) >>> calibration.estimates[:, 1].round(4) # b_2 - b_1 = log(2 / 1) array([-0.3466, 0.3466])
- calibrate(responses: NDArray[floating[Any]]) Calibration[source]#
Estimate the difficulties of the items of a complete response matrix.
Examinees with no item or every item correct change no estimate and are left out, as are items answered correctly by every examinee or by none, repeatedly until neither is left.
- Parameters:
- responsesnumpy.ndarray
The response matrix: one row per examinee, one column per item, holding 1 or 0.
- Returns:
- Calibration
The estimates
[1, b, 0, 1], the variances of the difficulties, the only entries of the covariances that are not NaN, and the conditional log-likelihood at them, of the examinees and items kept; the result has no grid. An item left out has a NaN difficulty and variance, and the result’s bank leaves it out, with aRuntimeWarningnaming it. If the stopping rule, a full step within the tolerance, is not met withinmax_cycles, or no halving of a step keeps the log-likelihood from falling, the result says so and aConvergenceWarningis issued; if the information matrix cannot be inverted at the estimates, or gives a variance that is not positive, the result has no covariances or standard errors and aRuntimeWarningis issued.
- Raises:
- TypeError
If the responses are neither Booleans, integers nor floats.
- ValueError
If the responses fail
irtlib.calibration.validate_responses()or have a missing response; no item is left once examinees and items are left out; the conditional likelihood has no maximum, which the error explains by the two groups of items the responses split into; or the information matrix is singular during the iterations.