JCD-EEG aggregate-result analysis code
====================================

Purpose
-------
Reproduce the descriptive comparisons in "Frequency band choice and the incremental
value of joint EEG representations for cognitive task classification" from the four
supplied aggregate input CSVs. JCD-EEG means joint complexity and dependence analysis
of EEG. MFCSync remains the label of the established processing workflow in method rows.

Requirements and layout
-----------------------
Python 3.8 or later; standard library only. No package installation is required.

Keep JCD_EEG_Analysis.py and this README beside a Source_Data directory containing:
  Band_Accuracy.csv
  Mean_Accuracy_and_Gains.csv
  Fusion_Gain_by_Band.csv
  Supplementary_F1_AUC.csv

From that directory, run:
  python JCD_EEG_Analysis.py --input Source_Data --output Results

When --input is omitted, the script looks for Source_Data beside the script, then
one directory above. The default output is a Results directory beside the script.
Use a separate output directory. The script never writes to the source CSVs.

Outputs
-------
Seven derived CSVs and Analysis_Report.json are created:
  Band_Interval_Summaries.csv
  Best_Nonfusion_Summary.csv
  Best_Nonfusion_Band_Contrasts.csv
  Relative_Error_Reduction.csv
  Supplementary_F1_AUC_Contrasts.csv
  Reference_Choice_Decomposition.csv
  Score_Perturbation_Sensitivity.csv

The JSON report includes source SHA-256 hashes, row counts, the main results and
their interpretation limits. Numeric calculations use decimal.Decimal. Output
formatting uses nearest rounding with half-up ties; this formatting choice does
not establish how the original study tables were rounded.

Definitions and expected results
--------------------------------
Accuracy source values are percentages; differences are percentage points (pp).
Fbar = separately reported MFCSync mean.
Cbar = the larger separately reported mean of WA-MFDFA and SNW-PCMI.
Fmin = the lowest MFCSync accuracy across the seven reported bands.
Cmax = the largest accuracy across all seven non-fused methods and seven bands.
Delta = Fbar - Cbar; U = Cmax - Cbar; D = Fbar - Fmin.
G = Fmin - Cmax = Delta - U - D.

SC: 3.50 - 0.93 - 1.17 = 1.4 pp.
EM: 2.47 - 0.90 - 1.07 = 0.5 pp.
The best non-fused configuration is SNW-PCMI / Alpha1 for both tasks.

Relative error reduction = (fusion - reference) / (100 - reference).
Reported-mean reductions are 30.36% (SC) and 24.46% (EM), based on gains of
3.50 and 2.47 pp. Means of rounded band entries or bandwise reductions must not
replace the separately reported mean summaries.

If every fusion and non-fused score can change separately by at most epsilon pp,
the resulting separation is at least G - 2*epsilon. Strict positivity is guaranteed
for epsilon < 0.70 pp (SC) and epsilon < 0.25 pp (EM). Equality permits a zero margin.
This is a coordinatewise bound, not a common additive shift of all scores.

The original band accuracies have a displayed step of 0.1 pp. The actual source
rounding rule is UNKNOWN. Only if nearest rounding to that step is assumed does
the coordinate error bound become 0.05 pp, giving conditional gap lower bounds
of 1.3 pp (SC) and 0.4 pp (EM). Under the same assumption, the strict thresholds
for an additional coordinatewise perturbation are 0.65 and 0.20 pp. These are
conditional arithmetic bounds, not confidence intervals or measured error rates.

Scope
-----
Inputs are 158 aggregate records, including previously calculated mean and
matched-band gains; outputs are 66 further derived records. The reported accuracy,
F1 and AUC values are distinguished from these calculated differences in Methods.
Derived rows are not new experimental observations. Bands are related analysis conditions,
not independent replicates. The best configuration is a retrospective table
comparison, not an evaluated selection policy. F1/AUC keep their separate composite
evaluation basis. No participant-level significance or cross-subject result is inferred.

This program supplies analysis code for the reported aggregate results. It does
not supply or reproduce original EEG preprocessing, feature extraction, PCA/SVM
training, trial partitioning or participant-level predictions. Access to the
original experimental pipeline is a separate code-availability matter.
