CCA / Section 6.4 / Theorem 2 replication package
================================================

The supplied input contains 825 respondents, four dimensions, 66 listed traits
(61 nonempty), and 554 distinct trait profiles. The original exact quotas imply
a group size of 75. Trait labels remain anonymized as supplied.

CASE 1: case1_original_quotas/respondents.csv adds selection_probability to the
original respondent columns. The original quotas are unchanged. Probabilities
depend only on the complete (a,b,c,d) profile and minimize the respondent-weighted
sum of squared deviations from 75/825, subject to consistency and [0,1] bounds.
The exact rational probabilities are in profile_targets.csv. The decimal column
is a 17-digit numerical representation; the companion fractions are authoritative.
This calibration is a declared modeling choice, not a recovered priority vector.
It gives 424 respondents probability zero and respondent 695 probability one.

CASE 2: case2_uniform/categories.csv changes every lower/upper quota to the
floor/ceiling of (75/825) times that trait's respondent count. The companion
respondents.csv adds the common probability 1/11. quota_audit.csv compares all
original and adjusted quotas, population counts, and expected counts.

EXPERIMENT: 10,000 independent-path draws per case from the sampling procedure
underlying Theorem 2. Seeds: 20261010 and 20261011. Every draw starts again at p.
The finite collection is a Monte Carlo sample, not the explicit sparse lottery
obtained by support compression. Empirical inclusion frequencies need not equal p.
The exact-arithmetic law preserves p and group size, and its quota miss is at
most D-1 = 3. Floating-point diagnostics and all realized integer counts are saved.

QUOTA MISS: max(lower-count, count-upper, 0), in seats. Average quota violation
is the mean of these misses across all 66 listed rows, then across draws.
The report also gives the denominator-61 average excluding empty traits.
The maximum quota miss is calculated separately for every selected group.
No cancellation of shortfalls against excesses occurs.

FILES
  input/                         Exact byte copies of the supplied CSVs
  case1_original_quotas/          Case 1 inputs, targets, results, and certificate
  case2_uniform/                  Case 2 inputs and results
  */panel_members.csv            Every draw's 75 nationbuilder_id values
  */panels.csv                   Same panels using zero-based source row indices
  */panel_metrics.csv            Every draw's average and maximum quota miss;
                                  also all 66 trait counts and quota misses
  */trait_results.csv            Per-trait sample counts and quota-miss statistics
  */marginal_diagnostics.csv      Each respondent's target and empirical frequency
  */sampler_input.txt            Exact numerical input consumed by C++
  */sampler_diagnostics.json      Numerical tolerances' observed residuals and time
  */summary.json                 Case-specific summary statistics
  results.json / results_summary.csv   Combined machine-readable summaries
  input_validation.json          Dataset and calibration characteristics
  verification.json             Independent verification result
  run_manifest.json              Seeds, versions, source hashes, and ordering
  CCA-results-report.pdf/.tex    Full explanation, results, and all-trait appendix
  paper-results-snippet.tex       Standalone prose suitable for Section 6.4
  run_experiment.py              Data preparation, calibration, run, and summaries
  theorem2_sampler.cpp           Theorem 2 sampling construction, C++17
  verify_results.py              Independent standard-library verification
  build_report.py               Regenerates TeX report and paper snippet
  requirements.txt              Numerical Python dependency versions

REPRODUCTION
Requirements: Python 3.11 or later; NumPy/SciPy as in requirements.txt; a C++17
compiler available as c++ (or set CXX). The archived run used Python 3.12.14,
GCC 13.3.0, NumPy 2.3.5, and SciPy 1.17.0 on x86_64 Linux.

From this directory:

  python3 -m pip install -r requirements.txt
  OPENBLAS_NUM_THREADS=1 OMP_NUM_THREADS=1 python3 run_experiment.py --draws 10000 --seed 20261010
  python3 verify_results.py
  python3 build_report.py
  pdflatex -interaction=nonstopmode -halt-on-error CCA-results-report.tex
  pdflatex -interaction=nonstopmode -halt-on-error CCA-results-report.tex

The first command above uses the archived rational profile targets. Add
--recalibrate to reconstruct them from the raw inputs using SLSQP to identify
the active set and exact rational arithmetic to solve and certify the optimum:

  OPENBLAS_NUM_THREADS=1 OMP_NUM_THREADS=1 python3 run_experiment.py --draws 10000 --seed 20261010 --recalibrate

The --draws and --seed options allow other experiments. Running the script
overwrites generated outputs in the two case folders. Preserve a copy of the
archive if you wish to keep the published run. Rebuild the report after changes.
Different draw counts measure Monte Carlo sensitivity, not exact expectations.

The standard-library verifier can check the delivered files without installing
NumPy, SciPy, a compiler, or LaTeX. LaTeX is needed only to rebuild the PDF.

NUMERICAL DETAILS
Columns are considered in original respondent order and active trait rows in
original categories order. Incremental elimination chooses the first column
dependency, with largest-magnitude row pivot (first row wins ties). The null
direction is normalized to maximum absolute entry one. Endpoint choice uses
std::mt19937_64 and its top 53 bits. The full source defines all tolerances.
Null directions use double precision; states, step sizes, and sums use long
double. Final single-coordinate residues are corrected only if within 1e-9 of
the unique integral value forced by total size; the actual maximum correction
is recorded. Coordinates within 1e-15 of a cube endpoint are snapped to it.
Every realized panel is checked independently against exact integer quotas.
Different compiler/architecture floating-point behavior may alter a random
branch and hence later panels. Seeds alone do not guarantee bitwise identity
across platforms. The exact archived panel files are the empirical record.

Scope: only the two requested CCA instances and Theorem 2's sampling procedure
are run. This package supplies no LEXIMIN comparison and no HD experiment.
The report does not treat the sampled panels as an exact marginal implementation
by an equally weighted finite-support distribution.
