# 069. Historical fuel economy trend

**Question:** How does observed city-cycle fuel economy vary by model year?

## Result

The largest computed metric is 33.7 for 1980.0; the smallest is 17.1 for 1973.0. Metric: mean_mpg (Miles per US gallon).

These are sampled historical models, not sales-weighted fleet statistics.

![Historical fuel economy trend](outputs/chart.png)

| model_year | vehicles | mean_mpg | median_mpg | calendar_year |
| --- | --- | --- | --- | --- |
| 70 | 29 | 17.69 | 16 | 1970 |
| 71 | 28 | 21.25 | 19 | 1971 |
| 72 | 28 | 18.71 | 18.5 | 1972 |
| 73 | 40 | 17.1 | 16 | 1973 |
| 74 | 27 | 22.7 | 24 | 1974 |
| 75 | 30 | 20.27 | 19.5 | 1975 |
| 76 | 34 | 21.57 | 21 | 1976 |
| 77 | 28 | 23.38 | 21.75 | 1977 |
| 78 | 36 | 24.06 | 20.7 | 1978 |
| 79 | 29 | 25.09 | 23.9 | 1979 |
| 80 | 29 | 33.7 | 32.7 | 1980 |
| 81 | 29 | 30.33 | 31.6 | 1981 |
| 82 | 31 | 31.71 | 32 | 1982 |

The chart shows 13 of 13 result rows; the table previews the first 13 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

Model-year sample counts, means and medians.

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

Separate vehicle-composition changes from within-design improvements before explaining a trend.

Historical city-cycle vehicle observations are not current fleet performance. Vehicle mix and model year are confounded. A '?' horsepower value means missing, not zero. 

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/069-historical-fuel-economy-trend/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

[Auto MPG](https://archive.ics.uci.edu/dataset/9/auto+mpg), Quinlan (1993). [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/). Source data are transformed and aggregated in this study. [Source provenance](../../data/provenance/auto.json) and [prepared-data audit](../../data/provenance/auto_prepared.json) record the downloaded files, field coverage and hashes.
