Analysis overview and configuration
| Parameter | Value | _row |
|---|---|---|
| lambda_selection | 1se | lambda_selection |
| n_folds | 10 | n_folds |
| confidence_level | 0.95 | confidence_level |
| n_lambda | 100 | n_lambda |
This analysis applies ridge regression to predict sales from three advertising channels (TikTok, Facebook, Google Ads) using L2 regularization. Ridge regression balances predictive accuracy with coefficient stability by penalizing large coefficients, making it ideal for multicollinear advertising spend data where all channels likely contribute to sales.
The model successfully captures the relationship between advertising spend and sales while controlling for multicollinearity through regularization. Google Ads shows the strongest effect (coefficient 1.01), followed by Facebook (0.41) and TikTok (0.31). The 1se lambda selection trades
Data preprocessing and column mapping
| Metric | Value |
|---|---|
| Initial Rows | 200 |
| Final Rows | 200 |
| Rows Removed | 0 |
| Retention Rate | 100% |
This section documents the data cleaning and preparation phase for the ridge regression model predicting sales from multi-channel advertising spend. Perfect data retention (100%) indicates no observations were removed during preprocessing, meaning the full dataset of 200 records was available for model training and evaluation.
The absence of data removal suggests the dataset was clean and complete at intake, with no missing values requiring exclusion. This full retention is favorable for model stability and statistical power. However, the lack of a documented train/test split indicates the model evaluation relied entirely on cross-validation metrics rather than holdout validation, which may slightly overestimate generalization performance compared to independent test set evaluation.
The preprocessing quality directly supports the model's R² of 0.763 and RMSE of 1310.17, as no data quality issues compromised the analysis. The 10-fold cross-validation approach (evident from the cv_plot_data) substitutes for explicit train/test documentation but provides robust
| Finding | Value |
|---|---|
| Model Type | Ridge Regression (L2) |
| Observations Used | 200 |
| Predictors | 3 |
| R-squared | 0.7635 (76.3% variance explained) |
| RMSE | 1310.1733 |
| MAE | 1106.3535 |
| Optimal Lambda | 509.136800 |
| Lambda Selection | 1SE |
| CV Folds | 10 |
This ridge regression model was developed to predict sales from multi-channel advertising spend (TikTok, Facebook, Google Ads) using regularized linear regression. The analysis demonstrates whether the three advertising channels can reliably forecast sales outcomes and how regularization improves model stability compared to standard linear regression.
The model achieves the stated objective of predicting sales from advertising spend with solid predictive power. Ridge regularization successfully stabilized coefficient estimates by penalizing large weights, reducing overfitting risk. The 1SE selection method prioritizes generalization
Cross-validation error across lambda values with optimal regularization selection
This section evaluates regularization strength through 10-fold cross-validation across 100 lambda candidates. It identifies the optimal balance between model complexity and generalization loss—critical for ensuring the ridge regression model performs well on unseen data rather than overfitting to the training set.
The 1se selection criterion trades ~7% higher CV loss (1,768,833 vs. 1,652,192 MSE) for a more conservative model with stronger regularization. This choice reflects the principle that simpler, more stable models generalize better when performance gains are marginal. The wide confidence bands around the loss curve confirm substantial fold-to-
Coefficient shrinkage paths showing how each predictor's coefficient changes as regularization increases
The ridge trace visualizes how advertising channel coefficients shrink as regularization intensity increases across the full lambda path. This section demonstrates the core mechanism of L2 regularization: smooth, continuous coefficient reduction that prevents overfitting while retaining all predictors. Understanding this path is essential for validating why the optimal lambda (509.14) balances prediction accuracy with model stability.
The ridge trace reveals that Google Ads spending has the most stable relationship with sales across regularization levels, while TikTok and Facebook show greater coefficient volatility. At the selected lambda of 509.14, all three channels retain meaningful influence on sales predictions (coefficients: Google Ads
Actual vs predicted values showing overall model fit quality
This section evaluates how well the ridge regression model predicts sales from multi-channel advertising spend. Model fit quality directly determines whether predictions are reliable for business decisions. Strong fit metrics indicate the three advertising channels (TikTok, Facebook, Google Ads) effectively explain sales variation.
The ridge regression achieves solid predictive accuracy for the advertising spend-to-sales relationship. The 76.3% variance explained demonstrates that advertising channels are primary sales drivers, though 23.7% of variation remains unexplained—likely from unmeasured factors (seasonality, pricing, competition). Residual statistics show the
Comparison of ridge (regularized) versus OLS (unregularized) coefficients
This section compares ridge-regularized coefficients against unregularized OLS estimates to reveal how regularization adjusts the model's parameter estimates. It demonstrates the bias-variance tradeoff inherent in ridge regression: shrinking coefficients reduces overfitting risk while introducing controlled bias. Understanding these adjustments is critical for interpreting the model's predictive behavior in the sales forecasting objective.
All three advertising channels retain positive coefficients after regularization, confirming their continued relevance to sales prediction. The modest shrinkage percentages (14.9%–17%) indicate that multicollinearity among predictors is present but not
Detailed model performance metrics at optimal lambda
| Metric | Value |
|---|---|
| R-squared | 0.7635 |
| RMSE | 1310.1733 |
| MAE | 1106.3535 |
| Lambda (optimal) | 509.136847 |
| Lambda selection | 1se |
| Observations used | 200 |
| Predictors | 3 |
| CV folds | 10 |
This section evaluates how well the ridge regression model predicts sales from multi-channel advertising spend at the optimal regularization level. These metrics quantify prediction accuracy and validate whether the model provides useful forecasting capability for the business objective.
The ridge model demonstrates solid predictive performance for sales forecasting across TikTok, Facebook, and Google Ads channels. The 76% variance explained indicates the three advertising channels collectively capture the primary drivers of sales variation. RMSE relative to the outcome's spread confirms predictions are sufficiently accurate for practical business use,