algo-forecast-arima
Skill238 starsChanged 6 months agoMITView on GitHub
Build ARIMA models for time series forecasting with trend and seasonality decomposition. Use this skill when the user needs to forecast future values from historical sequential data, test for stationarity, or select ARIMA parameters — even if they say 'time series forecast', 'predict next month sales', or 'ARIMA model'.
In this repository315 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- algo-ad-biddingSkill
- algo-ad-budgetSkill
- algo-ad-ctrSkill
- algo-ad-gspSkill
- algo-ad-vcgSkill
- algo-blockchain-basicsSkill
- algo-blockchain-smart-contractSkill
- algo-ecom-bm25Skill
- algo-ecom-rankingSkill
- algo-ecom-searchSkill
- algo-forecast-ensembleSkill
- algo-forecast-exponentialSkill
- algo-forecast-prophetSkill
- algo-hr-compensationSkill
- algo-hr-matchingSkill
- algo-hr-turnoverSkill
- algo-mfg-cpkSkill
- algo-mfg-doeSkill
- algo-mfg-fmeaSkill
- algo-mfg-spcSkill
- algo-net-centralitySkill
- algo-net-communitySkill
- algo-net-influenceSkill
- algo-nlp-ldaSkill
- algo-nlp-nerSkill
- algo-nlp-similaritySkill
- algo-nlp-summarizationSkill
- algo-price-bundleSkill
- algo-price-conjointSkill
- algo-price-dynamicSkill
- algo-price-elasticitySkill
- algo-price-van-westendorpSkill
- algo-rank-bayesianSkill
- algo-rank-eloSkill
- algo-rank-trueskillSkill
- algo-rank-wilsonSkill
- algo-rec-cfSkill
- algo-rec-contentSkill
- algo-rec-hybridSkill
- algo-rec-mfSkill
- algo-rec-sessionSkill
- algo-risk-altman-zSkill
- algo-risk-benfordSkill
- algo-risk-creditSkill
- algo-risk-varSkill
- algo-sc-bullwhipSkill
- algo-sc-eoqSkill
- algo-sc-newsvendorSkill
- algo-sc-routingSkill
- algo-sc-safety-stockSkill
- algo-seo-backlinkSkill
- algo-seo-contentSkill
- algo-seo-crawlSkill
- algo-seo-pagerankSkill
- algo-seo-schemaSkill
- algo-seo-technicalSkill
- algo-seo-tfidfSkill
- algo-social-engagementSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
3 rules. About 0 are common, 3 are distinctive, and 0 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.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 38
Check: regular time intervals, no missing values (impute if needed), minimum 50 observations (ideally 2+ full seasonal cycles).
- Distinctive: line 51
Check residuals: should be white noise (no autocorrelation).
- Distinctive: line 81
Verify: differenced series is constant (2) → no AR/MA terms needed.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 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.
Files
ARIMA Time Series Model
Overview
ARIMA(p,d,q) combines autoregression (AR), differencing (I), and moving average (MA) for time series forecasting. Seasonal variant: SARIMA(p,d,q)(P,D,Q,s). Requires stationary data (achieved through differencing). Best for univariate series with clear trend/seasonality patterns.
When to Use
Trigger conditions:
- Forecasting univariate time series (sales, demand, traffic)
- Data has clear trend and/or seasonal patterns
- Need interpretable model with statistical properties
When NOT to use:
- For multivariate forecasting with many external features (use ML models)
- For very long-range forecasts (ARIMA confidence intervals widen rapidly)
- For irregular/event-driven data (use causal models)
Algorithm
IRON LAW: ARIMA Requires STATIONARY Data
Non-stationary data (trend, changing variance) violates ARIMA assumptions.
Test stationarity with ADF test (p < 0.05 = stationary).
If non-stationary: difference the series (d=1 usually suffices).
If still non-stationary after d=2, ARIMA may not be appropriate.Phase 1: Input Validation
Check: regular time intervals, no missing values (impute if needed), minimum 50 observations (ideally 2+ full seasonal cycles). Test stationarity with ADF test. Gate: Data is regular, sufficient length, stationarity assessed.
Phase 2: Core Algorithm
- Stationarity: ADF test. If p > 0.05, difference (d=1). Retest.
- Parameter selection: Examine ACF/PACF plots. Or use auto_arima (AIC-based grid search).
- p (AR terms): PACF cutoff lag
- q (MA terms): ACF cutoff lag
- d: number of differences needed
- Fit model: Maximum likelihood estimation
- Forecast: Generate predictions with confidence intervals
Phase 3: Verification
Check residuals: should be white noise (no autocorrelation). Ljung-Box test (p > 0.05 = no autocorrelation). Residuals normally distributed. Gate: Residuals pass Ljung-Box test, no remaining patterns.
Phase 4: Output
Return forecasts with confidence intervals.
Output Format
{
"forecasts": [{"period": "2025-04", "forecast": 1250, "lower_95": 1100, "upper_95": 1400}],
"model": {"order": [1,1,1], "seasonal_order": [1,1,1,12], "aic": 520.3},
"metadata": {"training_periods": 60, "forecast_horizon": 12}
}Examples
Sample I/O
Input: 12 monthly observations with upward trend: [10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32]
Step 1: First difference = [2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2] (constant → stationary, d=1 sufficient)
Step 2: ARIMA(0,1,0) random walk with drift μ=2 is the simplest fitting model.
Expected forecast (ARIMA(0,1,0) with drift=2):
- Period 13: 32 + 2 = 34
- Period 14: 32 + 4 = 36
- Period 15: 32 + 6 = 38
Verify: differenced series is constant (2) → no AR/MA terms needed. Residuals are exactly 0 → perfect fit (toy example). On real data, residuals should pass Ljung-Box (p > 0.05).
Edge Cases
| Input | Expected | Why |
| No trend, no seasonality | ARIMA(p,0,q) | No differencing needed |
| Strong trend only | ARIMA(p,1,q) | Single difference removes linear trend |
| Multiple seasonalities | ARIMA may struggle | Consider Prophet or TBATS instead |
Gotchas
- Over-differencing: d=2 when d=1 suffices introduces unnecessary noise. Check if first difference is stationary before differencing again.
- Auto-ARIMA isn't magic: AIC-based selection can pick overfit models. Always check residual diagnostics regardless of auto selection.
- Confidence intervals widen fast: Multi-step forecasts accumulate uncertainty. Don't trust point forecasts beyond 2-3 seasonal cycles.
- Calendar effects: Business days, holidays, and leap years affect monthly/weekly data. ARIMA doesn't handle these natively — add regressors or use Prophet.
- Structural breaks: ARIMA assumes the data-generating process is stable. COVID, market shocks, or policy changes break this assumption.
References
- For ACF/PACF interpretation guide, see
references/acf-pacf.md - For SARIMA seasonal parameter selection, see
references/seasonal-arima.md
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
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.

