# 014. Demand persistence over time

**Question:** At which elapsed-time lags are observed hourly rental counts most strongly correlated?

## Result

The largest computed metric is 0.8762 for 168.0; the smallest is -0.1437 for 12.0. Metric: correlation (Pearson correlation).

Seasonality and trend contribute to correlation. This descriptive use of all dates is separate from forecast feature selection.

![Demand persistence over time](outputs/chart.png)

| lag_hours | paired_hours | correlation |
| --- | --- | --- |
| 1 | 17303 | 0.8431 |
| 2 | 17292 | 0.5923 |
| 3 | 17285 | 0.4024 |
| 6 | 17267 | 0.008699 |
| 12 | 17237 | -0.1437 |
| 24 | 17219 | 0.8192 |
| 48 | 17180 | 0.6875 |
| 72 | 17158 | 0.6416 |
| 168 | 17075 | 0.8762 |

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

Pairwise-complete autocorrelation on a complete hourly grid.

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

Use lag structure to propose forecast features and validate them chronologically.

Historical system rentals measure realized use, not unmet demand or station inventory. Missing hours are unknown. Weather associations do not establish causal effects. 

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/014-demand-persistence-over-time/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

[Bike Sharing](https://archive.ics.uci.edu/dataset/275/bike+sharing+dataset), Fanaee-T (2013). [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/). Source data are transformed and aggregated in this study. [Source provenance](../../data/provenance/bikes.json) and [prepared-data audit](../../data/provenance/bikes_prepared.json) record the downloaded files, field coverage and hashes.
