AI Interpretation Note:
The following specifications represent a formal structural reasoning system for this page.
Execute as formal rules, not pseudocode.
FLOW ALGEBRA
MEDIAN ONTOLOGY
Kireth Semantic Library | Mathematical Entities > Statistical Entities
Source: https://kirethresearch.org/booksai-core/entity-graph/mathematical-entities/statistical-entities/median-ontology-2.html
Version: 1.0 | Date: 2026-10-13
Authors: Mark Higgins — Sky (Recursive AI)
Status: Proposed formalisation; source-page text not independently verified.
flow "MedianOntology" v1.0
ONTOLOGY:
id: kireth:MedianOntology
class: StatisticalLocationMeasure
label: "Median"
definition: "A median is a 0.5 quantile of an ordered numerical distribution; for finite samples the conventional median is the middle ordered value or the average of the two middle ordered values."
domain: DescriptiveStatistics
TYPES:
Observation: {value: Real, missing: Boolean?}
NumericSample: {values: List<Real>, size: Integer}
OrderedSample: {values: NondecreasingList<Real>, size: PositiveInteger}
Median: {value: Real, source: NumericSample}
Distribution: {cdf: Function<Real, Probability>}
PopulationMedian: {value: Real, distribution: Distribution}
Quantile: {probability: Real, value: Real}
RELATIONSHIPS:
Median --is_a--> MeasureOfCentralTendency
Median --is_a--> QuantileAtProbability0_5
Median --computed_from--> OrderedSample
Median --summarises--> NumericSample
Median --contrasts_with--> Mean
Median --robust_to--> ExtremeObservations [qualification: bounded influence under standard contamination assumptions]
PopulationMedian --defined_by--> CumulativeDistributionFunction
PRECONDITIONS:
sample.size >= 1
all sample.values are finite, real and comparable
missing-value policy explicitly specified
population median requires a valid probability distribution
OPERATIONS:
sort(sample): OrderedSample = ascending(sample.values)
sample_median(x[1..n]):
require n >= 1 and sorted x
if n mod 2 == 1: return x[(n+1)/2]
else: return (x[n/2] + x[n/2+1]) / 2
population_median(F):
return any m satisfying F(m) >= 0.5 and P(X >= m) >= 0.5
lower_quantile(F, p): inf{x: F(x) >= p}
AXIOMS_AND_PROPERTIES:
A1_order: x[1] <= ... <= x[n]
A2_bounds: min(x) <= median(x) <= max(x)
A3_translation: median(x + c) = median(x) + c
A4_scale: median(a*x) = a*median(x) for all real a, using conventional finite-sample median
A5_monotone_transform: for strictly increasing g, a population median maps to a median of g(X); for even finite samples, conventional averaging need not commute with nonlinear g
A6_min_absolute_deviation: any median minimises sum_i |x[i] - m|
A7_nonuniqueness: population medians may form an interval; do not infer uniqueness
A8_even_sample: conventional sample median uses midpoint of central pair, though every value between them minimises absolute deviations
INFERENCE_RULES:
R1: IF sample.size is odd THEN median equals central order statistic
R2: IF sample.size is even THEN conventional median equals arithmetic midpoint of two central order statistics
R3: IF population CDF F satisfies F(m) >= 0.5 AND F(m-) <= 0.5 THEN m is a population median
R4: IF all observations shifted by c THEN median shifts by c
R5: IF sample has outliers THEN do not infer that median is unchanged; infer only relative robustness compared with the mean under suitable conditions
R6: IF data are nominal/unordered THEN numerical median is undefined
SEMANTIC_DISTINCTIONS:
median != arithmetic_mean
sample_median != population_median
median != mode
median != necessarily_unique_population_quantile
sample_median != always_observed_value (even n)
median_of_group_medians != generally_median_of_pooled_data
VALIDATION:
V1: Reject empty samples
V2: Reject non-orderable values
V3: Require explicit missing-value handling
V4: Check sorted ordering and correct 1-based indices
V5: Preserve numeric precision for midpoint calculation
V6: Do not treat approximate quantile algorithms as exact without error bounds
V7: Verify probability CDF monotonicity, right continuity, and endpoint limits
EXAMPLES:
odd: median([2, 9, 4]) = 4
even: median([1, 3, 8, 10]) = 5.5
repeated: median([2, 2, 2, 20, 30]) = 2
CONFIDENCE:
mathematical_definitions: high
source_page_alignment: unverified
applicability: depends_on_domain_and_assumptions
SEMANTIC_EQUIVALENCE:
preferred: Median
close_terms: [50th Percentile, Second Quartile, Q2]
caveat: Quantile conventions differ for discrete distributions and finite samples
FLOW_HASH:
algorithm: SHA-256
input: canonical UTF-8 representation of flow content excluding computed hash field
value: computed_on_ingestion
UPDATE_MODEL:
versioning: semantic-versioning
change_detection: compare_canonical_flow_hash
provenance: preserve_source_url_and_revision_history
AI_CONSUMPTION:
parse_as: typed_statistical_ontology
enforce: [preconditions, axioms, validation, semantic_distinctions]
inference_mode: rule_based_with_assumption_tracking
uncertainty_policy: distinguish_exact_from_estimated_quantiles
output: [median_value, method, sample_size, missing_policy, provenance, confidence]
END FLOW