# 010. Ninety-day repeat purchase cohorts

**Question:** How does repeat purchasing compare when every eligible customer receives 90 days of follow-up?

## Result

The largest computed metric is 0.5944 for 2010-12; the smallest is 0.3838 for 2011-05. Metric: rate (90-day repeat share).

First observed is not necessarily first-ever purchase. Simultaneous invoices do not count as a later purchase. Wilson intervals assume independent customers.

![Ninety-day repeat purchase cohorts](outputs/chart.png)

| month | events | n | rate | wilson_lower | wilson_upper |
| --- | --- | --- | --- | --- | --- |
| 2010-12 | 526 | 885 | 0.5944 | 0.5617 | 0.6262 |
| 2011-01 | 202 | 417 | 0.4844 | 0.4368 | 0.5323 |
| 2011-02 | 167 | 380 | 0.4395 | 0.3904 | 0.4897 |
| 2011-03 | 189 | 452 | 0.4181 | 0.3735 | 0.4641 |
| 2011-04 | 125 | 300 | 0.4167 | 0.3623 | 0.4732 |
| 2011-05 | 109 | 284 | 0.3838 | 0.3292 | 0.4416 |
| 2011-06 | 93 | 242 | 0.3843 | 0.3253 | 0.4469 |
| 2011-07 | 81 | 188 | 0.4309 | 0.3621 | 0.5023 |
| 2011-08 | 78 | 169 | 0.4615 | 0.3881 | 0.5367 |
| 2011-09 | 31 | 53 | 0.5849 | 0.4509 | 0.7074 |

The chart shows 10 of 10 result rows; the table previews the first 10 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

First-observed invoices and a fixed 90-day eligibility window.

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

Compare cohorts with equal observation time before testing acquisition or onboarding changes.

Historical invoice lines; credits are not reliably matched to original sales. Gross purchases are not profit. Unidentified customers cannot support customer-level conclusions. Exact repeated lines remain unless the study explicitly compares removal. 

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/010-ninety-day-repeat-purchase-cohorts/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

[Online Retail](https://archive.ics.uci.edu/dataset/352/online+retail), Chen (2015). [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/). Source data are transformed and aggregated in this study. [Source provenance](../../data/provenance/retail.json) and [prepared-data audit](../../data/provenance/retail_prepared.json) record the downloaded files, field coverage and hashes.
