DOI: 10.5281/zenodo.13905876
title: Service Level Anchoring in Demand Forecasting: The Moderating Impact of Retail Promotions and Product Perishability

description: This dataset is used for the working paper "Service Level Anchoring in Demand Forecasting: The Moderating Impact of Retail Promotions and Product Perishability," authored by Fahimnia, Tan, and Tahirov. The data was collected during a laboratory experiment designed based on data from a real case in the fast-moving consumer goods (FMCG) industry. Each subject was assigned to one of the following treatment groups:



T1 - forecasts were made for a nonperishable product (shelf life of 9 months), with no service level information.

T2 - forecasts were made for a perishable product (shelf life 1 day), with no service level information.

T3 - forecasts were made for a nonperishable product, with a high service level information.

T4 - the forecasts were still for a nonperishable product, with a lower service level information.

T5 - forecasts were made for a perishable product, with high service level information.

T6 - forecasts were made for a perishable product, with low service level information.


A total of 368 subjects prepared four forecasts each. For each forecast, a subject was provided with 30 weeks of sales data, including both normal and promotional weeks. The promotional weeks were highlighted as "Promo." The subjects were asked to provide their forecasts for week 31, basing their forecasts solely on historical data and potential sales promotions. Mean absolute percentage error (MAPE) was used to assess the accuracy of the forecasts. Percentage forecast bias was used to measure the deviation of adjusted forecasts from the normative benchmark forecast.
description: The dataset includes four Excel and two code script files:1. Excel files 1 and 2: "database_analysis.xlsx": Contains average adjusted forecasts for each subject during both promotional and non-promotional periods, along with demographic information, calculated MAPE, forecast bias, service level, and product perishability. This file is used as input data in the "data_cleaning.R" script."database_plot.xlsx": Contains a compact and cleaned version of similar data from the first file and was used for creating visuals such as boxplots.2. Excel Files 3 and 4:"Pool_1_Perishable.xlsx" and "Pool_2_Non_Perishable.xlsx": Contain real datasets for perishable and non-perishable products used in the experiment.3. Code Script File:"data_cleaning.R": This script performs data pre-processing by cleaning and transforming the dataset."analysis.R": This script loads the cleaned data and performs statistical analysis, including ANOVA, hypothesis testing, and visualization.
description: The major steps of the R code scripts are described below. Please make sure to review this guidance before running the code.

Notes================================1. We recommend using RStudio for running these scripts.2. Ensure that all files, including the Excel file (database_analysis.xlsx), are in the same folder as the scripts for smooth execution.3. Warning Message During Analysis:-During the analysis script (analysis.R), you may encounter the following warning:1. Data Aggregation: Multiple observations per design cell were aggregated using the mean. This is an expected behavior for repeated measures, and the default setting can be overridden by passing fun_aggregate = mean explicitly.2. Missing Values: Some observations were removed from the analysis due to missing values. This removal was done automatically to ensure the accuracy of the analysis, and the script proceeds with the remaining complete data.

Overview==============================

This repository contains two R scripts designed for reprocessing and analysing a dataset. The primary goal is to clean the data, remove outliers, and perform statistical analysis. Below, you will find a brief description of both scripts.

 

Data Cleaning Script (data_cleaning.R)===========

#Steps:

1. Load Packages: Loads necessary packages such as dplyr and readxl.

2. Read Data: Reads the data from database_analysis.xlsx.

3. Select Variables: Converts variables like Subject_No and Treatment_No to factors and assigns meaningful labels.

4. Outlier Removal:

- Defines thresholds using the Interquartile Range (IQR) to identify and filter out outliers for each treatment and promotional condition.

- Creates a new dataset no_outlier that contains only non-outlier data.

5. Extract Variables: Adds new factor variables ServiceLevel and Perishability from Treatment_No for more detailed analysis.

 

Analysis Script (analysis.R)====================

#Steps:

1. Install and Load Packages: Installs and loads required packages like ggplot2, car, lsmeans, etc., for statistical analysis and visualization.

2. Import Cleaned Data: Sources the data_cleaning.R script and prepares the cleaned dataset for analysis.

3. ANOVA Analysis:

- Conducts ANOVA on percentage_bias to assess how ServiceLevel, Perishability, and Promo influence forecast bias.

- Performs a similar ANOVA for MAPE (forecast accuracy).

4. Hypothesis Testing:

- Tests hypotheses regarding the impact of service level, perishability, and promotional conditions on forecast bias.

- Generates visualizations of the interactions between these factors using ggplot2.

5. Random Effects Analysis:

- Uses lme to evaluate random effects, considering Subject_No as a random factor, to account for variability across individuals.

6. Visualization:

- Creates and saves multiple plots to illustrate the effects of service level, perishability, and promotions on forecast bias.

7. Export Data:

- Exports the cleaned dataset without outliers to an Excel file for further use.