Back to Projects
Business Analytics / Retail

Customer Loyalty Analysis

Regression and correlation analysis for a retail consumer goods scenario, testing which of product quality, brand awareness and negative publicity drives customer loyalty, and which combination explains the most.

Type
Regression Modelling
Domain
Retail / Consumer Goods
Methods
Linear Regression, Pearson Correlation
Origin
Cambridge DS Career Accelerator coursework
LOYALTY DRIVERS
R² = 0.628
QUALITY • r = 0.713
NEG. PUBLICITY • r = -0.449
BRAND AWARENESS • r = 0.18

The Challenge

Across 1,711 customers, product quality was the strongest correlate of loyalty (r = 0.713), well ahead of brand awareness (r = 0.18). A three-variable linear model explained 62.8% of loyalty variance on a held-out test set.

The scenario asked which lever deserves investment: product quality, brand awareness or reputation management. Intuition alone could not settle which mattered most, or how much each added once the others were accounted for.

Approach

01
Exploratory Analysis
Examined distributions and relationships between loyalty and three candidate drivers: perceived product quality, brand awareness and negative publicity.
02
Predictive Modelling
Trained a linear regression on an 80/20 train/test split and evaluated it on the held-out test set with R², adjusted R² and residual sum of squares.
03
Model Experimentation
Compared four predictor combinations, all three variables and each pair, to see how much each factor adds.
04
Correlation Analysis
Ran Pearson correlation with p-values for loyalty against each driver, plus quality against negative publicity.

Results

r = 0.713
Quality vs loyalty: strong, highly significant positive correlation
r = -0.449
Negative publicity vs loyalty: moderate, highly significant negative correlation
R² = 0.628
Held-out test set, all three variables (adjusted R² = 0.625); quality + negative publicity alone reaches 0.623

Product quality is the primary loyalty driver by a clear margin, and negative publicity has a real suppressing effect. Brand awareness showed only a weak correlation (r = 0.18).

Dropping brand awareness barely changes the model (R² 0.623 vs 0.628), while dropping quality collapses it to 0.211. Two signals, quality and negative publicity, carry almost all of the explanatory power.

What It Means

The results point to a clear priority order: product quality first, managing negative publicity second, brand awareness third. Awareness campaigns on their own are unlikely to move loyalty much without a quality story behind them.

Technology Stack

Python Pandas Scikit-learn Seaborn Matplotlib Linear Regression Pearson Correlation
Interested in this work or something similar?