When analyzing data, it is often necessary to compare two regression models to determine which best fits a data point. Often a model is a simpler version of a more complex model that includes additional parameters. However, more parameters do not always guarantee that a more complex model is actually better, as they could simply overfit the data.
To determine if the added complexity is statistically significantwe can use what is called F test for nested models. This statistical technique evaluates whether the reduction in the Residual Sum of Squares (RSS) due to the additional parameters is significant or simply due to chance.
In this article I explain the F test for nested models and then present a step-by-step algorithm, demonstrate its implementation using pseudocode, and provide Matlab code that you can run immediately or redeploy on your favorite system (here). I chose Matlab because it gave me quick access to statistics and fitting functions, which I didn't want to waste time on). Throughout the article we'll see examples of the F-test for nested models at work in a couple of configurations, including some examples that I incorporated into the Matlab example code.