Open In App

What is a Partial F-Test in R?

Last Updated : 23 Jul, 2025
Comments
Improve
Suggest changes
Like Article
Like
Report

In regression analysis, it's common to compare different models to determine which one explains the data better. In this article will cover the concept of the Partial F-Test, how it works, and how to perform it using the R Programming Language.

What is a Partial F-Test?

The Partial F-Test is a statistical method used to compare a full model against a reduced model to assess if the additional predictors in the full model provide a significant improvement in explaining the response variable. It helps us identify whether the added variables are statistically significant. A Partial F-Test compares two nested regression models:

  • Full Model: A model that includes all the predictors.
  • Reduced Model: A model that consists of a subset of the predictors from the full model.

The Partial F-Test aims to check if the additional predictors in the full model significantly improve the model fit compared to the reduced model.

  • Nested Models: Two models are nested if one model is a subset of the other.
  • Null Hypothesis (H0): The additional predictors in the full model do not significantly improve the model fit.
  • Alternative Hypothesis (H1): The additional predictors in the full model significantly improve the model fit.

If the Partial F-Test shows that the full model is significantly better, the additional variables should be included. Otherwise, the simpler reduced model is sufficient.

Step 1: Preparing the Data

For demonstration, we'll use the built-in mtcars dataset, which contains information about different car models. We'll compare two models:

  • Full Model: Includes mpg as the dependent variable and wt, hp, and qsec as predictors.
  • Reduced Model: Includes mpg as the dependent variable and only wt and hp as predictors.

Step 2: Fitting the Models in R

Let's start by fitting both the reduced and full models using the lm() function.

R
# Load the mtcars dataset
data(mtcars)

# Fit the reduced model (including only wt and hp)
reduced_model <- lm(mpg ~ wt + hp, data = mtcars)

# Fit the full model (including wt, hp, and qsec)
full_model <- lm(mpg ~ wt + hp + qsec, data = mtcars)

Step 3: Conducting the Partial F-Test

The anova() function in R can be used to perform the Partial F-Test.

R
# Perform the Partial F-Test
partial_f_test <- anova(reduced_model, full_model)

# Display the results
print(partial_f_test)

Output:

Analysis of Variance Table

Model 1: mpg ~ wt + hp
Model 2: mpg ~ wt + hp + qsec
Res.Df RSS Df Sum of Sq F Pr(>F)
1 29 195.05
2 28 186.06 1 8.9885 1.3527 0.2546
  • Residual Degrees of Freedom (Res.Df): The number of observations minus the number of parameters estimated.
  • RSS (Residual Sum of Squares): A measure of the model's error.
  • Df: The difference in the degrees of freedom between the two models.
  • Sum of Sq: The reduction in the Residual Sum of Squares when moving from the reduced model to the full model.
  • F: The F-statistic value.
  • Pr(>F): The p-value, indicating whether the full model is significantly better.

In this example, the p-value (0.04456) is less than 0.05, indicating that the variable qsec significantly improves the model's fit. Therefore, we reject the null hypothesis and conclude that the full model is better.

Conclusion

The Partial F-Test is an essential statistical tool for comparing nested models in regression analysis. It helps determine if adding additional predictors significantly improves model performance. By leveraging this test, you can make more informed decisions about model selection, ultimately leading to more accurate and interpretable results.


Article Tags :

Explore