The Null Institute

Reproduce Our NHANES Blood-Pressure Reclassification Analysis

Open reproducibility note for How Often Does One Blood Pressure Reading Change the Category?

Below is the exact stand-alone Python reproduction of our headline NHANES 2021–2023 estimate, tested on both original-format data files on 13 October 2026. It uses publicly downloadable CDC survey data and produces the weighted percentage and the Taylor-linearised 95% confidence interval.

Data

  1. DEMO_L.xpt, CDC source download (11,933 records).
  2. BPXO_L.xpt, CDC source download (7,801 records).

Place the two files and the copied script in one folder. Install pandas, numpy and scipy in Python 3. The code runs entirely locally and makes no network requests.

Reproduction script

"""Reproduce the NHANES 2021-2023 one-reading reclassification estimate.
Input: CDC original DEMO_L.xpt and BPXO_L.xpt in the current directory.
Python: pandas, numpy, scipy. Data are not diagnoses.
"""
import numpy as np
import pandas as pd
from scipy.stats import t

D = pd.read_sas('DEMO_L.xpt', format='xport')
B = pd.read_sas('BPXO_L.xpt', format='xport')
M = D.merge(B, on='SEQN', how='left')
M = M[(M['RIDSTATR'] == 2) & (M['RIDAGEYR'] >= 18)].copy()
columns = [f'BPXOSY{k}' for k in (1, 2, 3)] + [f'BPXODI{k}' for k in (1, 2, 3)]
M = M.dropna(subset=columns + ['WTMEC2YR', 'SDMVSTRA', 'SDMVPSU'])
M = M[M['WTMEC2YR'] > 0].copy()

def category(s, d):
    return np.select([ (s >= 140) | (d >= 90),
                       (s >= 130) | (d >= 80),
                       s >= 120], [3, 2, 1], default=0)

first = category(M.BPXOSY1, M.BPXODI1)
mean_sys = M[[f'BPXOSY{k}' for k in (1, 2, 3)]].mean(axis=1)
mean_dia = M[[f'BPXODI{k}' for k in (1, 2, 3)]].mean(axis=1)
after = category(mean_sys, mean_dia)
M['changed'] = (first != after).astype(float)
W = M.WTMEC2YR.sum()
p = np.sum(M.WTMEC2YR * M.changed) / W
M['influence'] = M.WTMEC2YR * (M.changed - p)
U = M.groupby(['SDMVSTRA','SDMVPSU'])['influence'].sum().unstack(fill_value=0)
assert U.shape == (15, 2), f'Unexpected PSU design: {U.shape}'
se = np.sqrt(np.square(U.iloc[:, 0] - U.iloc[:, 1]).sum()) / W
critical = t.ppf(0.975, df=15)
print('Complete adult n:', len(M))
print('Unweighted changed:', int(M.changed.sum()))
print(f'Weighted changed: {100*p:.6f}%')
print(f'95% CI: {100*(p-critical*se):.6f}% to {100*(p+critical*se):.6f}%')

Expected output

Complete adult n: 6100
Unweighted changed: 990
Weighted changed: 16.408655%
95% CI: 15.362351% to 17.454959%

Statistical and scientific limits

We model the examination sample with WTMEC2YR, 15 masked strata and 30 primary sampling units (PSUs). The variance is a Taylor-linearised estimate for the weighted ratio, with 15 degrees of freedom for the Student-t confidence interval. The analysed population is the complete-reading adult subset; missing observations and instrument/systematic errors are not corrected by this standard error.

This calculation compares a first measured value with the average of the first, second and third measured values during the same visit. The first measurement is included in the average. It does not estimate the accuracy of a clinical hypertension diagnosis, habitual home BP or the effect of anxiety.

Data and code reuse: This script may be copied and adapted with attribution to The Null Institute. The NHANES data belong to their original source, CDC/NCHS. For additional transition tables and methods, cite the main research report. Archived version 1.0: DOI 10.5281/zenodo.23342882; all versions.