Home/News & Insights/Overfitting: What is it and how to avoid it?
Company News

Overfitting: What is it and how to avoid it?

By AlternativeSoftAlternativeSoft

A frequent mistake when using predicting models is to over-stress the importance of R-squared, this can often lead to the problem of overfitting.

This phenomenon occurs when the number of the parameters is increased to a point where, despite the in-sample errors are being minimised the model begins to lose its ability to predict using out-of-sample data.

Let us take a sample of n observations, as the number of regressors k increases towards n, the ability of the model to predict in-sample values of the dependent variable will increase, such that when k=n the model will perfectly fit the data.

While the above regression might be able to fully explain the variation of the data sampled, it will clearly be less effective when predicting using new observations.

The graph above shows how, as we increase the number of regressors (i.e., the complexity of the model), the estimated betas will excel at minimizing errors of the sample however will fail to do so when used on out-of-sample data.

A way to avoid superfluous regressors from eroding the degrees of freedom of a regression is to use measures like Adjusted R-Squared to quantify the goodness of the fit. The latter introduces a penalty each new explanatory variables. The Adjusted R-Squared only increases when the new regressor adds sufficient explanatory power that justifies its inclusion. Another way to avoid overfitting would be to only include factors that have p-values lower than 0.05 (or 0.10).

In conclusion, it is important to be parsimonious with the number of independent variables. While it might appear that more factors will lead to a better regression, it is essential to consider other the negative impacts that overfitting will have on the predictive power of the model. Although there are numerous ways to select the correct number of regressors, a common practice is to aim to maximise the Adjusted R-Squared of the regression. This allows to minimise the error for out-of-sample data prediction.

Thanks to the Stepwise Regression available on AlternativeSoft, it is possible to maximise the Adjusted R-Squared; for any given set of potential factors, the software will automatically rule out any redundant regressor.


N.B. This article does not constitute any professional investment advice or recommendations to buy, sell, or hold any investments or investment products of any kind, and should be treated as more of an illustrative piece for educational purposes.

To trial a truly powerful and comprehensive analytic software for investment decisions, fund allocation, and our new, innovative digital due diligence visit alternativesoft.com , call us on +44 20 7510 2003, or email us information@alternativesoft.com

This article was published in July 2021. Figures, fund names and market references reflect that date; the analytical methods described are available in the current AlternativeSoft platform.
Request a Demo

See AlternativeSoft
in Action

Join 150+ institutional investors who rely on AlternativeSoft to select and monitor funds. Book a personalised demo with our team today.

  • Live walkthrough of the full platform
  • Tailored to your asset class - hedge funds, mutual funds or private markets
  • Q&A with our investment analytics specialists
  • Free trial access available following the demo
  • Dedicated onboarding and implementation support
Hedgeweek Best Risk Management Software: voted by clients 4 years running
Data integrations include:
Bloomberg eVestment Morningstar Preqin Pitchbook HFR

Book Your Demo

Complete the form and we'll respond within one business day.

Book a DemoFree trial after the demo. Reply within one business day.