Disclosure-safe "approximate median" (average of 5 central sorted values)
Source:R/utils-panel.R
approx_median.RdA confidentiality-preserving stand-in for a true median: true medians are
not published per this project's disclosure rules. Sorts x ascending
(NA sorted last, matching Stata's convention — see
Pseudocode/00_conventions.md, MISSING), then averages the (up to) 5
values centred on position round_half_up(n_non_missing / 2). This is
not interchangeable with a true median except by coincidence — do not
replace with median().
Details
Typically used inside a dplyr::summarise() / grouped aggregation, one
call per output cell, rather than reproducing the source's
compute-then-collapse-then-mean row-broadcast mechanics (which reduce to
exactly this value).