Assignment 4.
Time Series Analysis and Forecasting
Title: Time Series Analysis and Forecasting of Online Retail Revenue
Objective:
The objective of this assignment is to conduct time series analysis and forecasting on the Online Retail dataset
using the Day and Revenue variables. Participants will learn to visualize temporal patterns, identify seasonality
and trends, apply statistical and machine learning models for forecasting, and evaluate their performance. This
exercise simulates a real-world business scenario where accurate forecasting of daily revenue supports inventory
management, marketing strategies, and financial planning.
Dataset Description:
For this assignment, the data is aggregated at a daily level, yielding two key variables:
• Day: Date representing daily aggregated sales.
• Revenue: Total daily revenue, computed as the sum of (Quantity × UnitPrice) for all transactions on that
day.
This dataset allows for temporal trend analysis, demand forecasting, and business planning.
Assignment Tasks:
1. Data Acquisition & Initial Assessment
• Import and load the dataset.
• Inspect data structure, dimensions, and completeness.
• Convert Day column to datetime format and set it as the time index.
• Summarize basic descriptive statistics for Revenue (mean, median, max, min).
• Check for missing days or irregular time intervals.
2. Exploratory Data Analysis (EDA)
• Plot the Revenue over time to identify patterns.
• Conduct decomposition of the series into Trend, Seasonality, and Residual.
• Perform ACF (Autocorrelation Function) and PACF (Partial Autocorrelation Function) plots to identify
correlations.
• Highlight special patterns such as seasonality, weekly cycles, or anomalies (e.g., holidays).
3. Data Preprocessing
• Handle missing or duplicate dates by interpolation or aggregation.
• Detect and adjust outliers in daily revenue.
• If necessary, apply transformations (e.g., log transformation) to stabilize variance.
• Split data into training and test sets based on time (e.g., 80%-20% split).
4. Model Development
• Apply baseline forecasting methods (e.g., moving average, naive forecast).
• Build advanced forecasting models:
a. ARIMA / SARIMA for capturing trend and seasonality and Forecasting.
b. Machine learning-based forecasting methods - Facebook Prophet or LSTM models.
• Tune model parameters using information criteria (AIC/BIC).
5. Model Evaluation
• Forecast revenue on the test dataset.
• Evaluate performance using error metrics:
a. RMSE (Root Mean Squared Error)
b. MAE (Mean Absolute Error)
c. MAPE (Mean Absolute Percentage Error)
• Compare results across models and select the best-performing one.
6. Forecasting & Visualization
• Generate forecasts for the next 30 days (or another business-relevant horizon).
• Plot actual vs. predicted revenue to visualize model accuracy.
• Visualize future revenue trends with confidence intervals.
7. Insights & Business Recommendations
• Summarize key time series patterns (e.g., upward trend, seasonality, cyclic behavior)
• Interpret forecasting results in a business context (e.g., high-revenue periods, expected demand spikes).
• Provide actionable recommendations for inventory, marketing campaigns, and resource allocation.
• Highlight limitations of the chosen forecasting models and suggest directions for improvement (e.g.,
incorporating external variables such as holidays, promotions).