Hui-Walter and Latent Class Models for Diagnostic Tests (Concept Note)

Summary

When no test is a gold standard, latent class analysis estimates prevalence and each test’s sensitivity and specificity from the joint pattern of results. Hui & Walter (1980) show two conditionally independent tests are identified if applied in two or more populations with different prevalence; with raters, the Dawid-Skene model is the multi-class generalisation. Conditional dependence between tests, label switching and degrees-of-freedom counting are the practical pitfalls. Concept note, no raw source; the numerical checks below are computed.

Overview

Observed: binary results of tests on each subject; latent: true status . Parameters: prevalence ; per test sensitivity and specificity . Under conditional independence given :

Main Content

Hui-Walter design

Two tests applied to subjects from populations with different prevalences but the same and (constant accuracy). Each population gives a table with 3 free cell probabilities.

Parameter counting for identifiability

With populations, 2 tests: data degrees of freedom ; parameters: . The model is exactly identified (saturated) - no degrees of freedom remain to check fit. Adding a third test or population gives over-identification. A single population with two tests has 3 data df but 5 parameters: not identified. With conditionally independent tests in one population the model is identified for ().

Conditional dependence

If tests share error mechanisms (same biological marker, same annotator guideline), conditional independence fails. Add covariance parameters (Dendukuri & Joseph 2001): and similarly for . These cost degrees of freedom and require more tests or populations; ignoring dependence biases prevalence and accuracy estimates (Albert & Dodd 2004 caution that latent class models can be non-robust to misspecified dependence - cited in Paun et al.).

Label switching and the Youden condition. The likelihood is invariant to swapping the roles of and with . Impose better-than-chance accuracy, Youden index for each test (or at least for one test), to select the correct mode; with a prior or constraint this removes the mirror solution. Relabelling post-hoc using a few gold labels is the Paun et al. recipe (Paun 2018 - Implementation Priors Label Switching and Guidelines).

Dawid-Skene link. Hui-Walter with raters is Dawid-Skene with binary classes, rater-specific confusion matrix and prevalence (Paun 2018 - Pooled and Unpooled Models Multinomial Dawid-Skene MACE).

Examples

Cell probabilities for a two-population Hui-Walter design

Setup. , , prevalences . Solution. Cells (++, +-, -+, —): population 1 ; population 2 - each sums to 1, giving 6 free numbers for 6 parameters. Interpretation. Different prevalence across the two groups is what breaks the symmetry; with equal prevalence the two tables would carry only 3 independent pieces of information.

import numpy as np
Se, Sp, pi = [.9, .8], [.95, .9], [.3, .1]
def cells(p):
    out = []
    for a in (1, 0):
        for b in (1, 0):
            pos = (Se[0] if a else 1-Se[0])*(Se[1] if b else 1-Se[1])
            neg = ((1-Sp[0]) if a else Sp[0])*((1-Sp[1]) if b else Sp[1])
            out.append(p*pos + (1-p)*neg)
    return np.array(out)
print(cells(pi[0]).round(4), cells(pi[1]).round(4))

PyMC-style sketch for E69 (untested): pi = pm.Beta("pi", 1, 1, shape=G); se = pm.Beta(...), sp = pm.Beta(...) with a Youden constraint such as pm.Potential("youden", pt.switch(se+sp > 1, 0, -np.inf)); marginalise by pm.math.logsumexp([log(pi)+..., log(1-pi)+...]) for each pattern count with a Multinomial likelihood.

Relevance to marketing measurement

Two noisy measures of the same latent outcome with no ground truth (e.g. a survey-recall conversion flag and a platform-attributed conversion) face the same structure; Hui-Walter requires subpopulations with different true rates (e.g. geos or cohorts) and constant measurement error across them - a strong assumption worth stating explicitly.

Connections

See Also

Paun 2018 - Comparing Bayesian Models of Annotation - Overview