Expected A Posteriori#
Motivation#
The expected a posteriori (EAP) estimate is the mean of the examinee’s posterior, the likelihood of its responses times a prior density of ability, and its standard error is the posterior standard deviation. It needs no search, only sums over a grid of abilities, and it is finite whatever the responses. Maximum A Posteriori takes the posterior’s mode instead.
The posterior variance “serves as its error variance” [Bock and Mislevy, 1982, p. 432], and in Bock and Mislevy’s simulations the posterior standard deviation came close to the standard error of measurement [Bock and Mislevy, 1982, p. 431].
Definition#
The EAP estimate is the mean of the examinee’s posterior over the grid of Quadrature and Ability Priors, and its standard error the posterior standard deviation [Bock and Mislevy, 1982, p. 433, Equations 4 and 5]; [Magis and Raîche, 2012, pp. 5-6, Equations 10 and 11]. Bock and Mislevy credit these quadrature formulas to Bock and Aitkin [1981] [Bock and Mislevy, 1982, p. 432].
Implementation#
The posterior is that of Quadrature and Ability Priors: the masses of the prior on the grid,
times the likelihood at each node, normalized, with no correction of the variance, where Bock and
Mislevy apply Sheppard’s correction [Bock and Mislevy, 1982, p. 433]. The nodes are evenly spaced, as
theirs are: Gauss-Hermite quadrature is exact for a function “weighted by the Gaussian error
function, that can be expressed as a polynomial of degree q”, and “this class does not include the
likelihood functions in adaptive testing” [Bock and Mislevy, 1982, p. 433]. It is finite
whatever the responses, and an examinee who answered no item gets the prior’s mean and standard
deviation on the grid. A caller that estimates many matrices with the same grid and prior can pass a
GridPrior built once instead of the two.
The grid’s accuracy. The grid is accurate while it resolves the posterior. Against a reference grid of 2,401 nodes on the same range, the default grid of 121 nodes, 0.1 apart, gives the posterior mean and standard deviation within 0.40% of the reference standard deviation while the posterior standard deviation is at least 0.065, which takes a test information of about 240. Below that it degrades: the error reaches 7.3% at a posterior standard deviation of 0.05 and 48% at 0.035. A grid of 41 nodes, 0.3 apart, is within 0.27% at 0.2, and reaches 7.3% at 0.15 and 41% at 0.11: the error depends on the ratio of the posterior standard deviation to the spacing. The errors are the worst over posterior means across \([-3, 3]\), for a normal likelihood under the standard normal prior (measured 2026-11-28). The default’s spacing is that of the 80 points between \(\pm 4\) standard deviations that Bock and Mislevy suggest to keep precision down to a posterior standard deviation of 0.2 [Bock and Mislevy, 1982, p. 433]. A standard error below about 0.065 needs a finer grid than the default.
Comparison with mirt and catR
mirt 1.48: irtlib’s default grid and prior are mirt’s, 121 nodes on \([-6, 6]\) (
R/fscores.R:302, 318-319;R/fscores.internal.R:231) with the standard normal density at the nodes, normalized (R/fscores.internal.R:316-317). mirt gives NA to an examinee who answered no item.catR 3.17: the parity tests first check that catR’s recorded EAP estimates are the posterior mean and standard deviation written out, on the same nodes and weights, then compare irtlib’s with them (ADR-0003).
Parameters#
Parameter |
Default |
Description |
Default from |
|---|---|---|---|
|
121 nodes on \([-6, 6]\) |
The nodes the posterior is computed on. |
mirt’s ( |
|
the standard normal |
The prior’s log-density. |
mirt’s ( |
|
None |
A |
none |
Guarantees#
Every estimate is finite, whatever the responses, and lies within the grid’s nodes.
An examinee who answered no item gets the prior’s mean and standard deviation on the grid.
References#
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.
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.
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.
API Reference#
- irtlib.ability.expected_a_posteriori(responses: ArrayLike, items: NDArray[floating[Any]], *, grid: QuadratureGrid | None = None, log_prior: LogPrior | None = None, grid_prior: GridPrior | None = None) AbilityEstimates[source]#
Return each examinee’s EAP estimate, the mean of its posterior over a grid, with the posterior standard deviation.
Every estimate is finite, whatever the responses; an examinee who answered no item gets the prior’s mean and standard deviation on the grid. The evaluation count is the number of grid nodes.
The Expected A Posteriori page gives the method, its sources and the origin of each default.
- Parameters:
- responsesarray_like
The response matrix, one row per examinee and one column per item: 1 or True for a correct response, 0 or False for an incorrect one, and NaN for a missing one.
- itemsnumpy.ndarray
The items
[a, b, c, d], a matrix of shape(n, 4), one row per column ofresponses, witha > 0and0 <= c < d <= 1.- gridQuadratureGrid or None, optional
The nodes the posterior is computed on. Default is
QuadratureGrid.uniform(), 121 nodes on [-6, 6].- log_priorLogPrior or None, optional
The prior’s log-density. Default is
normal_log_prior(), the standard normal.- grid_priorGridPrior or None, optional
A grid and prior evaluated once, in place of
gridandlog_prior, for a caller that estimates with the same ones many times. Default is None.
- Returns:
- AbilityEstimates
The posterior means, the posterior standard deviations and the grid’s size, one of each per examinee.
- Raises:
- TypeError
If the responses are neither Booleans, integers nor floats.
- ValueError
If
grid_prioris given together withgridorlog_prior. Also ifitemsis not an(n, 4)matrix of finite numbers,responsesis not a matrix with one column per item, a response is not 0, 1 or NaN, or the log-prior is NaN or +inf at a node or has no mass on the grid.
Examples
>>> import numpy >>> items = numpy.array([[1.0, -1.0, 0.0, 1.0], [1.5, 0.0, 0.2, 1.0], [0.8, 1.0, 0.0, 0.95]]) >>> estimates = expected_a_posteriori(numpy.array([[1, 0, numpy.nan], [1, 1, 1]]), items) >>> estimates.theta.round(4), estimates.standard_errors.round(4) (array([-0.2809, 0.8555]), array([0.7837, 0.828 ]))