Time Series Decomposition and Trend Analysis
Decompose time series data into trend, seasonality, and residual components to uncover patterns and build better forecasts.
Prompt Template
You are a senior data scientist specializing in time series analysis. Help me decompose and analyze the following time series dataset. **Dataset description:** [e.g., 3 years of daily e-commerce revenue data] **Granularity:** [e.g., daily, weekly, monthly] **Key metric:** [e.g., revenue in USD, active users, order count] **Known events:** [e.g., Black Friday spikes, COVID drop in March 2020, product launch July 2024] **Goal:** [e.g., understand seasonal patterns for staffing, detect structural trend changes, improve forecast accuracy] Perform the following analysis: 1. **Visual Inspection Guide** — what to look for when first plotting the raw series 2. **Stationarity Assessment** — ADF test interpretation, differencing strategy, and when to apply log transforms 3. **Decomposition** — apply STL decomposition: - **Trend component** — long-term direction and rate of change - **Seasonal component** — recurring patterns with amplitude analysis - **Residual component** — anomaly interpretation 4. **Multiple Seasonality Detection** — identify overlapping seasonal cycles 5. **Change Point Detection** — identify structural breaks and likely causes 6. **Actionable Insights** — translate findings into business recommendations 7. **Forecasting Readiness** — which model families suit this data and why Provide Python code snippets using statsmodels and/or Prophet where applicable.
Example Output
Time Series Analysis: Daily E-Commerce Revenue (2023-2025)
1. Visual Inspection
- **Upward trend**: revenue grew ~40% over 3 years
- **Strong weekly seasonality**: dips on Tuesdays, peaks on Fridays
- **Annual spikes**: Black Friday/Cyber Monday each November
- **Structural break**: step-up in March 2024 coinciding with product launch
2. Stationarity
from statsmodels.tsa.stattools import adfuller
result = adfuller(df['revenue'])
# p-value: 0.12 -> NOT stationary
# After first differencing: p-value 0.001 -> stationary
3. STL Decomposition
from statsmodels.tsa.seasonal import STL
stl = STL(df['revenue'], period=7, robust=True)
result = stl.fit()
result.plot()
- **Trend**: steady growth at ~$1,200/month, accelerating post-March 2024
- **Seasonal**: Friday revenue 23% above weekly average; Tuesday 15% below
- **Residuals**: 3 outlier spikes confirmed as Black Friday events
6. Business Recommendations
- **Staffing**: reduce support 15% on Tuesdays, increase 20% Fridays
- **Marketing**: shift ad spend toward Thursday/Friday
- **Forecasting**: use Prophet with custom holiday regressors
Tips for Best Results
- 💡Always plot your raw data before running any statistical tests
- 💡Use robust STL decomposition when your data has outliers
- 💡If residuals show patterns, your decomposition missed something
- 💡Log-transform data with exponential growth before decomposition
Frequently Asked Questions
What is the Time Series Decomposition and Trend Analysis prompt?
Decompose time series data into trend, seasonality, and residual components to uncover patterns and build better forecasts. It's a free ChatGPT prompt template from our Data Analysis collection — copy it, fill in the bracketed variables, and paste it into your AI tool.
Which AI tools work with this prompt?
It's written and tested for ChatGPT, Claude and Gemini. Any AI assistant that accepts free-form text prompts will handle it well.
How do I customize this ChatGPT prompt?
Replace the bracketed variables — such as [e.g., daily, weekly, monthly] — with your own details before running it. Always plot your raw data before running any statistical tests
Is this prompt free to use?
Yes. Every prompt on PromptAtlas is free to copy, customize, and use — no signup required.
Related Prompts
Transit Fare Evasion Pattern Analysis Builder
Analyze transit fare evasion patterns with station segments, time trends, inspection data, equity safeguards, revenue estimates, and intervention testing.
Food Pantry Distribution Demand Analysis Builder
Analyze food pantry demand, visit patterns, household needs, item stockouts, volunteer coverage, and distribution-slot capacity for nonprofit food programs.
Library Hold Queue Wait Time Analysis Builder
Analyze public library hold queues, copy availability, branch demand, wait times, and purchasing signals for print, ebook, audiobook, or media collections.
Sterile Processing Instrument Tray Turnaround Analysis Builder
Analyze sterile processing instrument tray turnaround times, bottlenecks, rework, case readiness, staffing, and quality issues for hospital operations.
Clinical Lab Specimen Turnaround Time Analysis Builder
Analyze clinical lab specimen turnaround time by collection, transport, accessioning, testing, verification, priority, department, and bottleneck risk.
Municipal Permit Processing Backlog Analysis Builder
Analyze building permit intake, review stages, resubmissions, staffing, and service targets to find bottlenecks and reduce municipal permit backlogs.