Skip to contents

Adult Step 9Wa, weight only, in kg measurement-space. Mirrors the child Step 9 anchor rule and one-exclusion-per-iteration selection (calc_otl_evil_twins + the Step 9 driver in child_clean.R); the scale differs (raw kg + interval/UW etcaps in place of z-scores).

Usage

evil_twins(w_subj_df, wtallow_formula = "piecewise")

Arguments

w_subj_df

Weight data for one subject (data.table with meas_m, age_days, sex, internal_id). All eligible (non-extraneous) values, RVs included.

wtallow_formula

Formula for wtallow/ET caps

Value

Character vector of internal_ids to exclude (Exclude-A-Evil-Twins)

Details

A weight is OTL ("over-the-limit") only if it is an inner member (B or C) of an evaluable over-the-limit pair: four age-ordered eligible values A, B, C, D where the inner B-C jump exceeds etcap(B,C) and BOTH outer pairs (A-B, C-D) anchor within 60% of their own etcap. A missing A or D disqualifies the pair, so single spikes (record ends and singles embedded between normals) cede to remove_ewma_wt(), which has the better-informed directional 90% rule and per-observation thresholds. All comparisons to etcap carry the 0.12 kg rounding tolerance used throughout the adult algorithm.

RVs (repeated values) participate as ordinary values: no special handling.

Selection per iteration (one exclusion): if a single OTL candidate, exclude it. Otherwise compute absd_med = |meas - windowed median| (median over +/-4 age-ordered positions, kg space) and route by the UER3 unit-error check and a median band, identically in structure to the child:

  • UER3 (computed ONCE on the initial Include set): if the SP splits cleanly into a unit-error group (unit_error_range flag, all one CSD-z sign) and a plausible group (|adult CSD z| < 3) whose mean kg differ by ~2.2046 (the lb<->kg factor, band 1.7-2.7), the unit-error block is the implausible one and the median can be pulled toward it, so exclude the highest |z|.

  • Otherwise: band = candidates whose absd_med is within band_width of the max absd_med, band_width = 0.20 * etcap(B,C) of the max candidate's inner pair (the adult analogue of the child's fixed z-unit band). If >= 2 in band (the windowed median cannot discriminate), exclude the highest |adult CSD z|; if exactly 1 (one absd_med stands clearly apart), absd_med is decisive.

  • Tiebreak: lowest internal_id.

Adult CSD z (sex-specific, NA-safe via the averaged sex=NA reference row) is used for the UER3 plausible group and the |z| tiebreak; weights are looked up as WEIGHTKG (meas_m is already kg).