Java Python
Background:
Market Disruption & Promotional Effectiveness at Sweet Delight
Sweet Delight, a leader in the gourmet snack market, has long relied on premium sweet potato chips and data-driven marketing strategies to drive growth. However, in Week 88, competitor CrunchyBite entered the market, leading to a noticeable decline in sales.
Sweet Delight's Head of Marketing is concerned about two key issues:
1. How much did CrunchyBite's entry actually impact sales? Was this a temporary dip, or has the company lost a significant market share?
2. How effective were past promotions (Weeks 9, 10, 35, 49, and 98)? Did they provide short-term sales spikes or contribute to sustained revenue growth?
With declining sales and increased competition, Sweet Delight must decide whether to:
· Invest more in promotions
· Adjust pricing
· Explore new strategic initiatives to regain market position.
Data:
The dataset, WeeklySales.csv.
This dataset contains weekly sales for Sweet Delight's chips, covering periods before and after CrunchyBite entered the market.
Question1:
Part 1. Pre-Competition Analysis: Establishing Baseline Trends & Promotion Effectiveness (Weeks 1–87)
Before assessing the impact of competition, analyze how sales were trending and how effective promotions were before CrunchyBite entered the market.
Tasks:
· Build a linear regression model that:
o Captures the linear trend to measure baseline sales growth or decline.
o Models each promotion in Weeks 9, 10, 35, and 49 as a distinct event, rather than grouping them together.
Question1.1
What was the average rate of change in weekly sales before competition? (Trend coefficient)
Your answer: (Round to two decimal places)
Question1.2
How much did each promotion impact sales?
·
o Promotion (Week 9):
Your answer: (Round to two decimal places)
o Promotion (Week 10):
Your answer: (Round to two decimal places)
o Promotion (Week 35):
Your answer: (Round to two decimal places)
o Promotion (Week 49):
Your answer: (Round to two decimal places)
Question 2 :
Part 2. Pre-Competition Analysis: Alternative Promotion Modeling: Treating All Promotions as the Same Type (Weeks 1 - 87)
Executives often seek generalized insights about promotions rather than assessing each one separately. Modify your regression model so that all promotions are treated as the same type of event, rather than assigning a unique effect to each.
Tasks:
· Adjust your model to capture the linear trend while treating all promotions as a single type of event instead of modeling them separately.
Question 2.1 :
Under this approach, what was the average rate of change in weekly sales before competition? (Trend coefficient)
Your answer: (Round to two decimal places)
Question 2.2 :
What was the estimated average impact of a promotion?
Your answer: (Round to two decimal places)
Clarification: Why Is This Approach Used in Practice?
Justification for Treating All Promotions as the Same Type
1. Statistical Evidence: Insignificance of Individual Promotion Dummies
o If individual promotion dummies are not statistically significant (i.e., p-values are large), this suggests that the differences between promotions are not meaningful from a statistical perspective.
o In contrast, if the single promotion dummy is significant, this indicates that promotions as a group have an effect, even if differences between them are minor.
o This aligns with the principle of parsimony (Occam's Razor) - keeping the model as simple as possible without losing meaningful insights.
2. Overlapping Confidence Intervals in Individual Promotions
o If individual promotion estimates have overlapping confidence intervals, it means that we cannot reliably distinguish between their effects.
o This supports the idea that treating them as one unified effect is appropriate.
3. Business Justification: Promotions Had Similar Characteristics
o If all promotions had similar structures (e.g., same discount percentage, marketing effort, dai 写Market Disruption & Promotional Effectiveness at Sweet DelightC/C++ and customer targeting), it makes sense to model them together.
o Business stakeholders usually do not need separate estimates for promotions that perform. similarly - they are more interested in an overall ROI on promotional campaigns.
4. Improved Model Stability & Interpretability
o If adding separate dummies for individual promotions introduces multicollinearity or instability (e.g., high variance in estimates), grouping them makes the model more robust.
Business leaders prefer models that offer clear, actionable insights - a single coefficient for promotions is easier to interpret than multiple uncertain estimates
Question 3:
Part 3. Competitive Impact Analysis: How CrunchyBite Changed Sales Trends (ALL DATA)
Now, analyze how CrunchyBite's entry in Week 88 changed the sales trajectory and determine whether promotions were still effective after competition entered the market.
Tasks:
· Build a model using the entire dataset that:
o Captures the linear trend before and after competition.
o Models the change in trend after CrunchyBite entered (often called the gradual effect of intervention).
o Models all promotions (including Week 98 promotion) as the same type while including an additional dummy variable to test whether the Week 98 promotion had a different impact compared to earlier promotions.
Question 3.1 :
By how much did the weekly growth rate (trend) of Sweet Delight's sales change due to CrunchyBite's entry?
Your answer: (Round to two decimal places, use a negative sign if the trend is negative)
Question 3.2:
What is the trend of weekly Sweet Delight sales after CrunchyBite entered the market?
Your answer: (Round to two decimal places, use a negative sign if decreased)
Question 3.3 :
Is the Week 98 promotion effect statistically significantly smaller than the overall promotion effect? (Write "Yes" or "No")
Your answer:
Question 4:
Part 4. Counterfactual Analysis: Estimating the True Impact of CrunchyBite
To quantify the total impact of CrunchyBite, you will build a counterfactual model using only data from before Week 88 to estimate what sales would have been if CrunchyBite had not entered the market. Your model should incorporate the linear trend, promotions (treated as a single type rather than distinct events), and significant lags to ensure an accurate prediction(this is your final model).
Question 4.1:
Using your final model: Estimate the total impact (loss) of CrunchyBite on Sweet Delight's sales: Impact = Counterfactual Sales - Actual Sales.
Your answer: Round to two decimal places.
Question 4.2:
What is the percentage impact (% loss) of CrunchyBite on Sweet Delight's sales? Use the following formula: Percentage Impact = (Counterfactual Sales −Actual Sales) / Counterfactual Sales ×100
Your answer: Round to two decimal places.
Why Include Lags?
· Sales patterns are often autocorrelated, meaning past sales influence future sales. Ignoring this can lead to biased estimates of the true sales trend.
· Lags help capture momentum in sales trends, correcting for fluctuations that might otherwise distort estimates.
· Including lags corrects for autocorrelation, ensuring that the model reflects actual data patterns instead of random noise.
· Lags impact trend estimates - without them, the pre-competition trend may appear stronger or weaker than it actually was, leading to incorrect counterfactual predictions.
· Lags impact promotion estimates - if past sales influence future sales, promotions might appear more or less effective depending on how previous weeks' sales are incorporated into the model.
How Lags Affect Trend and Promotion Estimates
· Trend estimates may decrease when lags are included because part of what was previously captured by the trend is now explained by past sales.
· Promotion effects may shrink because some of their impact is absorbed by previous sales trends, especially if sales increase naturally over time.
· Without lags, the estimated effect of promotions could be overstated, especially if sales were already increasing in the weeks following a promotion.
· When NOT to use lags:
o If the goal is causal inference, including lags may absorb too much variance and obscure the true impact of an event like a promotion or competition entry.
o If lags introduce multicollinearity, they can make estimates unstable and reduce the interpretability of the model