agentleFS
jskhermanjskherman/engg-skills/skills/time-series-process-data-analysis/SKILL.md

time-series-process-data-analysis

Skill7 starsChanged 6 months agoApache-2.0View on GitHub

Estimate the sample autocorrelation (ACF), partial autocorrelation (PACF), and run a moving-block bootstrap for autocorrelation-aware confidence intervals on selected statistics of process time series. Use when computing CIs for supported statistics from autocorrelated process data. Don't use for stationary white-noise data (use engineering-statistics) or for forecasting (use a dedicated time-series model).

The file

We split this skill into the rules it gives an agent

6 rules. About 0 are common, 3 are distinctive, and 3 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈3

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 3

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Use the block-len helper as a starting point.

    line 67
  2. Distinctive:

    Run the bootstrap. Compare the bootstrap SE / CI against the i.i.d.

    line 72
  3. Distinctive:

    If the series is too short for block bootstrap (<50), report the i.i.d.

    line 95
  4. Very specific:

    If statsmodels is available, use it for ARIMA-style residual diagnostics (not implemented here).

    line 97
  5. Very specific:

    Run the listed script with representative inputs and an --output file when a deterministic calculation is available.

    line 102
  6. Distinctive:

    Check result magnitudes against the stated assumptions, references, and a hand calculation or known operating range before reporting them.

    line 104

≈ “Common” is an estimate: at least 1 in 5 of the 372,429 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Time-Series Diagnostics and Block Bootstrap for Process Data

Overview

Process data are almost always autocorrelated, which means ordinary i.i.d. inference (Wald CIs, t-tests, normal CIs) understates uncertainty. This skill provides:

  • Sample ACF and PACF.
  • A simple block-length heuristic (2 × first lag where |rho| < 2/sqrt(n)).
  • Moving-block bootstrap (Kuensch 1989) for built-in statistics exposed by the CLI: mean, median, standard deviation, minimum, and maximum.

The ACF/PACF are useful for picking residual-autocorrelation orders for regressions and for selecting a sensible block length.

Prerequisites

  1. uv available.
  2. On first use, the script writes LICENSE_NOTIFICATION.txt.

When to Use

  • Computing a CI for the mean of a daily lab series.
  • Diagnosing autocorrelation before using a separate regression workflow.
  • Diagnosing the order of a residual AR(p) for ARIMA / DLM modelling.
  • Picking a block length for downstream block-bootstrap procedures.

Don't use for

  • Stationary white-noise data — use engineering-statistics.
  • Forecasting future values — use a state-space model.
  • Strongly non-stationary data — pre-process (detrend, deseasonalise) first.

Utility Scripts

  • uv run scripts/ts.py acf --data series.csv --column y --max-lag 30 --output /tmp/acf.json
  • uv run scripts/ts.py pacf --data series.csv --column y --max-lag 30 --output /tmp/pacf.json
  • uv run scripts/ts.py block-len --data series.csv --column y --output /tmp/L.json
  • uv run scripts/ts.py bootstrap --data series.csv --column y --block-length 8 --n-resamples 2000 --statistic mean --output /tmp/bs.json

Procedure

  1. Compute ACF and PACF; eyeball the lag structure.
  2. Pick a block length:
    • Use the block-len helper as a starting point.
    • For short series (< 200), constrain block length to ≤ n/4.
    • For long series, consider Politis-White optimal block length (not implemented; use statsmodels if needed).
  3. Choose a supported statistic (mean, median, std, min, or max).
  4. Run the bootstrap. Compare the bootstrap SE / CI against the i.i.d. counterpart; the bootstrap should be wider for positively autocorrelated data.
  5. Report both intervals for transparency.

Pitfalls

  • Using ordinary bootstrap (i.i.d. resampling) on autocorrelated data; the CI is too narrow.
  • Using a tiny block length (e.g. 2-3) for very autocorrelated data; the CI is still too narrow.
  • Using a huge block length (≥ n/4); the bootstrap has very few effective resamples and the CI is unreliable.
  • Reporting block-bootstrap CIs without specifying the block length.
  • Treating the PACF as if it were independent of ACF; they are connected by the Durbin-Levinson recursion.
  • Treating spikes outside ±2/sqrt(n) as automatically meaningful; the multiple-testing rate is not controlled.
  • Failing to detrend / deseasonalise before computing ACF; non-stationary trends inflate the ACF.

Fallback Strategies

  • If the series is too short for block bootstrap (<50), report the i.i.d. CI with a warning that it likely understates uncertainty.
  • If statsmodels is available, use it for ARIMA-style residual diagnostics (not implemented here).

Verification

  • Run the listed script with representative inputs and an --output file when a deterministic calculation is available.
  • Confirm the JSON result contains ok: true, expected units, and no unhandled warnings.
  • Check result magnitudes against the stated assumptions, references, and a hand calculation or known operating range before reporting them.

References

  • references/methods_notes.md — block-bootstrap derivation, references.
  • Kuensch, H. R. "The Jackknife and the Bootstrap for General Stationary Observations," Annals of Statistics, 1989.
  • Politis & Romano, Subsampling.

Anti-Patterns

  • Quoting "p < 0.05" on a process-data regression without addressing autocorrelation.
  • Designing SPC limits assuming independence on data that is clearly serially correlated.
  • Using the bootstrap to "rescue" a model that is misspecified.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.