# 031. Free and total sulfur consistency

**Question:** How variable is the free-to-total sulfur measurement ratio?

## Result

The largest computed metric is 0.8571 for maximum; the smallest is 0.02273 for minimum. Metric: free_to_total_ratio (Ratio).

Total sulfur must be positive; ratios over one are flagged for review, not automatically deleted.

![Free and total sulfur consistency](outputs/chart.png)

| statistic | free_to_total_ratio |
| --- | --- |
| minimum | 0.02273 |
| p10 | 0.1458 |
| p25 | 0.2021 |
| median | 0.2698 |
| p75 | 0.3488 |
| p90 | 0.4444 |
| p99 | 0.6898 |
| maximum | 0.8571 |

The chart shows 8 of 8 result rows; the table previews the first 8 in the analysis-defined order. [Download the full result table](outputs/results.csv). Numerical values are computed from the source; missing results stay unavailable.

## Method

Positive-denominator ratios, quantiles and an out-of-range audit.

The study uses shared source preparation and reusable statistical routines. Its specific transformations are in [analysis.py](analysis.py), and common model/evaluation code is in [portfolio/methods.py](../../portfolio/methods.py). The [notebook](analysis.ipynb) executes the study and displays the saved results.

## Decision and limitations

Investigate measurement or recording explanations for unusual ratios.

Sensory scores are ordinal and concentrated in the middle. Producer and batch IDs are unavailable. Associations are not recipes for changing quality or evidence of market price. 

Related studies may share observations or holdouts. These are focused analytical studies, not independent replications or deployed business systems. Any model refinements informed by these results need new untouched evaluation data. No commercial impact is inferred from an association or backtest.

## Reproduce

From the repository root, after installing `requirements.txt`:

```powershell
python projects/031-free-and-total-sulfur-consistency/analysis.py
```

Source data are downloaded automatically if absent. Original archives are retained unchanged and checked by SHA-256. The cleaned cache normalizes column names; field-specific changes are visible in [data preparation](../../portfolio/data.py). Runtime evidence is in [receipt.json](outputs/receipt.json).

## Source

[Wine Quality](https://archive.ics.uci.edu/dataset/186/wine+quality), Cortez et al. (2009). [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/). Source data are transformed and aggregated in this study. [Source provenance](../../data/provenance/wine.json) and [prepared-data audit](../../data/provenance/wine_prepared.json) record the downloaded files, field coverage and hashes.
