Marketing Analytics
RGM° · Training
Regression and Predictive Models
The workhorse of marketing analytics. Linear, logistic, tree-based, MMM as regression, feature engineering, validation, interpretation, deployment.
Why regression matters
Regression underlies most marketing analytics: MMM is regression; attribution models often use regression; LTV prediction uses regression. Understanding the basics enables interpretation of analyst outputs and recognition when methodology is misused.
Linear regression
Models continuous outcomes as linear function of predictors:
Y = β0 + β1X1 + β2X2 + … + βkXk + ε
- Coefficients (β): Effect of one-unit change in X on Y, holding others constant.
- R²: Proportion of variance explained.
- Standard errors: Uncertainty in coefficient estimates.
- P-values: Probability of observing coefficient if true effect were zero.
- Assumptions: Linearity, independence, homoscedasticity, normality of residuals.
Logistic regression
For binary outcomes (converted vs not, churned vs not).
- Models log-odds as linear function of predictors.
- Output: probability between 0 and 1.
- Use cases: Conversion prediction, churn prediction, lead scoring.
- Coefficients: Effect on log-odds; exponentiate for odds ratios.
Tree-based models
- Decision trees. Interpretable but high variance.
- Random forests. Ensemble of trees; lower variance.
- Gradient boosting (XGBoost, LightGBM, CatBoost). Best-in-class predictive accuracy for tabular data.
- Trade-offs: Predictive power vs interpretability; tree models often outperform linear but are harder to interpret.
- Use cases: LTV prediction, conversion probability, propensity scoring.
MMM as regression
- Sales(t) = β0 + Σ βi × adstock(saturation(spendi(t))) + Σ γj × controlj(t)
- Specialized regression incorporating adstock and saturation transformations.
- Bayesian formulation includes priors on coefficients.
- Covered in depth in Attribution & Measurement MMM module.
Feature engineering for marketing
- Time features. Day of week, month, holiday indicators, time since last action.
- Aggregations. Customer's purchase count, total spend, recency.
- Behavioral. Number of sessions, pages viewed, products browsed.
- Lookback windows. 7-day, 30-day, 90-day, lifetime aggregates.
- Interactions. Cross-feature combinations (e.g., channel × device).
- Categorical encoding. One-hot, target encoding, embedding.
- Missing data handling. Imputation, missingness indicators.
Validation and overfitting
- Train/test split. Hold out test data; never used in training.
- Cross-validation. K-fold for hyperparameter tuning.
- Time-based splits for time-series. Train on past; test on future.
- Overfitting signals. Train accuracy high, test accuracy low.
- Regularization. L1 (Lasso), L2 (Ridge), Elastic Net to prevent overfitting.
- Holdout validation. Final test on fully unseen data before deployment.
Interpretation and inference
- Linear coefficients. Directly interpretable as effect sizes.
- Tree model interpretability. SHAP values for per-prediction explanations.
- Feature importance. Which features matter most; useful but limited.
- Partial dependence plots. How does predicted Y change with X holding others constant?
- Counterfactual analysis. What would happen if we changed X?
- Communication. Plain-language summaries for non-technical stakeholders.
Productionizing models
- Batch vs real-time. Most marketing models batch-score (daily/weekly).
- Pipeline automation. Train, score, monitor, retrain.
- Monitoring. Data drift, prediction drift, performance decay.
- Retraining cadence. Quarterly or monthly; depending on environment stability.
- Tools. MLflow, Airflow, dbt, custom pipelines.
- BigQuery ML / Snowflake ML / Databricks ML. Warehouse-native ML for many marketing use cases.
Advanced playbook
- Model registry. All deployed models documented; lineage tracked.
- Feature store. Shared features across models; consistency.
- Calibration plots. Predicted probabilities match observed frequencies.
- Drift monitoring. Production data shifts from training; retrain triggers.
- SHAP for interpretability. Per-customer explanations of model predictions.
- Bayesian regression. Uncertainty quantification on coefficients and predictions.
- Time-series-specific methods. ARIMA, Prophet, neural network forecasting where appropriate.
- Ensembling. Combine multiple models; often outperforms any single.
- Champion-challenger. Test new models against incumbent in production.
- External validation. Compare model predictions to actual outcomes; report calibration.
Common mistakes
- Overfitting on training data; production performance disappoints.
- Time-series modeled with random splits; leakage from future.
- Linear model assumptions violated; coefficients misleading.
- Tree models without interpretability layer; black box.
- Features not validated; spurious predictors included.
- No monitoring in production; drift undetected.
- Retraining cadence ad-hoc; performance decays.
- Calibration ignored; predicted probabilities mismatched to reality.
- Tools without warehouse integration; data movement overhead.
- Models documented; lineage unknown.
- Bayesian methods skipped where uncertainty matters.
- Champion model never challenged; incumbent comfort.
Operating checklist
- Train/test split with time-aware logic for time-series
- Regularization applied to prevent overfitting
- Validation on fully held-out data before deployment
- Calibration plots for probabilistic predictions
- Feature documentation and lineage
- Production monitoring (data drift, prediction drift, performance)
- Retraining cadence documented
- Model registry with lineage
- SHAP or equivalent interpretability layer
- Champion-challenger testing
- External validation against actual outcomes
- Bayesian uncertainty where appropriate
Sources and further reading
- Frank Harrell, "Regression Modeling Strategies"
- Hadley Wickham, "R for Data Science"
- Aurélien Géron, "Hands-On Machine Learning"
- Trevor Hastie et al., "Elements of Statistical Learning"
- SHAP documentation (Scott Lundberg)
- XGBoost, LightGBM, CatBoost documentation
- scikit-learn documentation
- statsmodels (Python)
- BigQuery ML documentation
- Snowflake Cortex ML
- MLflow and Weights & Biases documentation
- Andrew Ng, Stanford CS229 lectures
Part of the Marketing Analytics series.