- Introduced by
- Breiman, L. (bagging framework)
- Year
- 1996
- Type
- Ensemble of linear models
- Family
- Machine learning
What does it do?
Ensemble Linear Regression fits several ordinary least-squares models, each on a different bootstrap sample of the training data, and averages their predictions.
It applies Breiman's bagging framework (1996) to linear models. Bagging was proposed for unstable base learners, so its benefit is largest when individual fits vary substantially between samples; for a stable linear fit the gain is usually modest. The final model remains linear in its predictors.
The intuition behind the method
A single OLS fit is usually a low-variance estimator when the sample is large relative to the number of predictors and the predictors are not strongly collinear. Its coefficients can still become unstable in small samples or when predictors are highly correlated. Fitting many linear models on bootstrap resamples and averaging their predictions reduces the influence of any one sample on the final prediction. The averaged coefficients still show the direction of each effect, and the spread of each coefficient across bootstrap fits gives a sense of sampling variability. The ensemble does not, however, provide the standard errors and p-values of a single OLS fit, so it is a variance-reduction tool rather than an inferential one.
History
The bagging idea behind this method comes from Leo Breiman's 1996 paper 'Bagging predictors', which proposed averaging predictors fitted on bootstrap samples and reported variance reduction for unstable learners. That paper concerns bagging in general, not linear regression specifically; applying it to linear models is a use of the framework.
When to use it
Choose this method when a linear relationship between the predictors and a continuous outcome is expected or required and you want an averaged linear predictor. It suits small to moderate samples, or predictors that are close to collinear, where a single unregularized fit may be unstable; in that case, use regularized base models (Ridge or Lasso). Before adopting it, compare the out-of-bag or cross-validated error of the ensemble with that of a single OLS or Ridge fit; if the single fit is already as accurate, the ensemble adds little. Do not use it when the relationship is clearly nonlinear and a tree-based ensemble would fit better, or when reporting requires exact p-values or standard errors, because averaged coefficients carry no standard inferential machinery.
Limitations and considerations
- Does not reduce bias: if a single linear regression is biased because of a wrong functional form, the averaged ensemble inherits the same bias.
- Loses the inferential machinery of OLS: p-values and confidence intervals from the individual base fits do not apply directly to the averaged coefficients.
- Requires fitting B models instead of one, so computing cost grows in proportion to the number of bootstrap models.
- Averaging does not address collinearity directly, so for large datasets where collinearity is the main problem, a single well-tuned Ridge or Lasso fit may offer a comparable or simpler remedy.
- Assumes a linear conditional mean and independent observations; the i.i.d. bootstrap is inappropriate for time series or clustered data unless block or cluster resampling is used.
- Each base fit needs a full-rank design matrix; when the number of predictors is close to or exceeds the number of observations, base models should be regularized (Ridge or Lasso).
Source conditions do not replace independent scientific review or validation by an analysis engine.
Strengths
- Can reduce prediction variance when base fits are unstable, without requiring a new model family; for stable OLS fits the gain is usually small.
- Averaged coefficients still convey direction of effect, preserving a degree of interpretability.
- Out-of-bag predictions provide an internal validation estimate at no extra data cost.
- Straightforward to implement using any standard linear regression library inside a bootstrap loop.
- Compatible with regularization (Ridge, Lasso) at the base-model level for further stability.
Applications
- Econometric prediction tasks where linearity is assumed but sample sizes are small.
- Medical and clinical prediction where a linear relationship is required by protocol but single-fit instability is a concern.
- Bootstrap percentile intervals of coefficients to communicate estimation uncertainty to non-technical audiences, with the caveat that these are not OLS confidence intervals and their coverage is not guaranteed for small samples or collinear predictors.
- Baseline ensemble model before trying gradient boosting or neural networks.
How it works
How it works
B bootstrap samples are drawn from the training set. Each sample is created by drawing observations with replacement, producing a dataset the same size as the original in which some observations are repeated and others are left out. The left-out observations form out-of-bag sets, which can be used to estimate prediction error without a separate validation sample.
An ordinary least-squares linear regression (or a regularized variant such as Ridge or Lasso) is fitted independently on each bootstrap sample, giving a coefficient vector for each of the B fits. Because each sample differs slightly, the coefficient vectors differ, reflecting sampling variation in the data.
Formula
\hat{y}_b = X_b \hat{\beta}_b,\quad b=1,\ldots,BFor a new input, every base model produces a predicted value. The ensemble prediction is the arithmetic mean of these B predictions. Averaging reduces the contribution of idiosyncratic errors in individual fits. When base fits are unstable this lowers prediction variance relative to any single base model; when they are already stable, the reduction is typically small.
Formula
\hat{y} = \frac{1}{B}\sum_{b=1}^{B} \hat{y}_bAs an alternative to simple averaging, a second-level meta-learner can be trained on the base models' predictions for observations they did not use in fitting, such as out-of-fold predictions. This is a separate procedure from bagging. It can weight base models differently, but it adds complexity, the weights should be constrained or regularized, and careful cross-validation is needed to avoid data leakage.
Common pitfalls
- Treating averaged coefficients as if they carry standard OLS standard errors or p-values.
- Using the ensemble when the data-generating relationship is substantially nonlinear, where a tree-based method would outperform it significantly.
- Forgetting to apply the same preprocessing (scaling, imputation) inside each bootstrap fold to avoid data leakage.
- Reporting in-sample R² from individual base models instead of the out-of-bag or cross-validated error of the ensemble.
Frequently asked questions
How many bootstrap models should I use?
There is no fixed number that suits every dataset. Increase the number of bootstrap models until the out-of-bag error stops changing appreciably between runs; where this happens depends on the data.
Is this the same as Ridge regression?
No. Ridge regression adds an L2 penalty to a single fit to handle collinearity. Ensemble linear regression averages many independently fitted models to reduce variance from sampling instability. They are complementary: each base model in the ensemble can itself be a Ridge regression.
Can I still interpret the coefficients?
You can compute the mean and standard deviation of each coefficient across B bootstrap fits. The mean coefficient indicates direction of effect; the standard deviation reflects sampling variability. However, formal p-values from individual OLS fits do not apply to these averaged estimates.
When should I prefer a random forest over this method?
When the relationship between predictors and the outcome is nonlinear or involves complex interactions, a random forest, which grows nonlinear trees, is usually better suited to capture those patterns. Ensemble linear regression is best when domain knowledge or reporting requirements call for a linear model.
Does averaging predictions reduce bias?
No. Averaging reduces variance but leaves bias unchanged. If every base linear model is biased, for example because the true relationship is quadratic, the ensemble average will be equally biased.
Related methods
Sources
Breiman, L. (1996). Bagging predictors. Machine Learning, 24(2), 123–140.
Open DOI referenceHastie, T., Tibshirani, R., & Friedman, J. (2009). The Elements of Statistical Learning (2nd ed., Ch. 8). Springer.
ISBN: 978-0-387-84857-0