# 072. Origin and model-year composition

**Question:** Does the origin comparison change when model years are grouped into comparable periods?

## Result

The largest computed metric is 33.48 for (77, 82] / origin 3; the smallest is 16.03 for (69, 73] / origin 1. Metric: mean_mpg (Miles per US gallon).

Origin codes are source categories, not a measure of driver behavior or modern national fleets.

![Origin and model-year composition](outputs/chart.png)

| period | origin | vehicles | mean_mpg | group |
| --- | --- | --- | --- | --- |
| (69, 73] | 1 | 89 | 16.03 | (69, 73] / origin 1 |
| (69, 73] | 2 | 21 | 24.71 | (69, 73] / origin 2 |
| (69, 73] | 3 | 15 | 24.67 | (69, 73] / origin 3 |
| (73, 77] | 1 | 75 | 19.02 | (73, 77] / origin 1 |
| (73, 77] | 2 | 24 | 25.83 | (73, 77] / origin 2 |
| (73, 77] | 3 | 20 | 28.12 | (73, 77] / origin 3 |
| (77, 82] | 1 | 85 | 25.26 | (77, 82] / origin 1 |
| (77, 82] | 2 | 25 | 32.54 | (77, 82] / origin 2 |
| (77, 82] | 3 | 44 | 33.48 | (77, 82] / origin 3 |

The chart shows 9 of 9 result rows; the table previews the first 9 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

Origin-stratified model-year bands with sample counts.

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

Check composition before presenting geographical comparisons of efficiency.

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/072-origin-and-model-year-composition/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.
