Skip to content

Commit 2b4a96e

Browse files
spec: add scatter-lag specification (#5264)
## New Specification: `scatter-lag` Related to #5251 --- ### specification.md # scatter-lag: Lag Plot for Time Series Autocorrelation Diagnosis ## Description A lag plot is a scatter plot of a time series against a lagged version of itself, plotting y(t) on the x-axis versus y(t+k) on the y-axis for a given lag order k. If the data is purely random, points scatter uniformly with no visible structure; if autocorrelation is present, distinctive patterns emerge — linear clusters for autoregressive processes, elliptical shapes for seasonal data. This provides a quick visual diagnostic for time series dependence, complementing numerical tools like ACF/PACF. ## Applications - Checking for autocorrelation before applying regression models that assume independent residuals - Diagnosing stationarity and serial dependence in financial return series - Identifying seasonal or cyclical patterns in sensor and environmental monitoring data - Validating residual independence after fitting ARIMA or other time series models ## Data - `value` (float) — time series observations in chronological order - `lag` (int) — lag order k, default 1 (plot y(t) vs y(t+k)) - Size: 100–5000 observations - Example: daily stock returns, hourly temperature readings, or synthetic AR(1) process data ## Notes - Default lag = 1, but the implementation should support configurable lag values (e.g., 1, 7, 12) - Include a diagonal reference line (y = x) to help assess whether the series is uncorrelated - Optionally color points by their time index to reveal temporal structure within the scatter - Strong linear pattern along the diagonal indicates high positive autocorrelation at the given lag; perpendicular spread indicates negative autocorrelation - Consider adding a correlation coefficient annotation (r value) to quantify the visual pattern --- **Next:** Add `approved` label to the issue to merge this PR. --- :robot: *[spec-create workflow](https://github.com/MarkusNeusinger/pyplots/actions/runs/24290847773)* Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
1 parent 4f038f5 commit 2b4a96e

File tree

2 files changed

+56
-0
lines changed

2 files changed

+56
-0
lines changed

plots/scatter-lag/specification.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# scatter-lag: Lag Plot for Time Series Autocorrelation Diagnosis
2+
3+
## Description
4+
5+
A lag plot is a scatter plot of a time series against a lagged version of itself, plotting y(t) on the x-axis versus y(t+k) on the y-axis for a given lag order k. If the data is purely random, points scatter uniformly with no visible structure; if autocorrelation is present, distinctive patterns emerge — linear clusters for autoregressive processes, elliptical shapes for seasonal data. This provides a quick visual diagnostic for time series dependence, complementing numerical tools like ACF/PACF.
6+
7+
## Applications
8+
9+
- Checking for autocorrelation before applying regression models that assume independent residuals
10+
- Diagnosing stationarity and serial dependence in financial return series
11+
- Identifying seasonal or cyclical patterns in sensor and environmental monitoring data
12+
- Validating residual independence after fitting ARIMA or other time series models
13+
14+
## Data
15+
16+
- `value` (float) — time series observations in chronological order
17+
- `lag` (int) — lag order k, default 1 (plot y(t) vs y(t+k))
18+
- Size: 100–5000 observations
19+
- Example: daily stock returns, hourly temperature readings, or synthetic AR(1) process data
20+
21+
## Notes
22+
23+
- Default lag = 1, but the implementation should support configurable lag values (e.g., 1, 7, 12)
24+
- Include a diagonal reference line (y = x) to help assess whether the series is uncorrelated
25+
- Optionally color points by their time index to reveal temporal structure within the scatter
26+
- Strong linear pattern along the diagonal indicates high positive autocorrelation at the given lag; perpendicular spread indicates negative autocorrelation
27+
- Consider adding a correlation coefficient annotation (r value) to quantify the visual pattern
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Specification-level metadata for scatter-lag
2+
# Auto-synced to PostgreSQL on push to main
3+
4+
spec_id: scatter-lag
5+
title: Lag Plot for Time Series Autocorrelation Diagnosis
6+
7+
# Specification tracking
8+
created: "2026-04-11T20:23:52Z"
9+
updated: null
10+
issue: 5251
11+
suggested: MarkusNeusinger
12+
13+
# Classification tags (applies to all library implementations)
14+
# See docs/reference/tagging-system.md for detailed guidelines
15+
tags:
16+
plot_type:
17+
- scatter
18+
data_type:
19+
- timeseries
20+
- numeric
21+
- continuous
22+
domain:
23+
- statistics
24+
- finance
25+
- general
26+
features:
27+
- correlation
28+
- temporal
29+
- 2d

0 commit comments

Comments
 (0)