Wald Test in R: How to Use waldtest() from lmtest | Reddit Users

Learn the Wald test in R using waldtest() and lmtest. Compare models, read chi-squared/F output, and see Wald vs LRT vs F-test explained.
Author photo
Written by Dr. Zubair, PhD Statistics
Reviewed by Dr Ali

Dr. Zuabir holds a PhD in Statistics and has helped 200+ PhD and Master's students complete their dissertation statistical analysis using R, SPSS, and Minitab.

Which predictors in your regression model actually matter — and how do you prove it with a single R function?

The Wald test in R answers that question directly: run waldtest() from the lmtest package to compare a full model against a reduced model, or wald.test() from aod to test specific coefficients against zero. Either way, the test tells you whether a predictor — or a group of predictors — is statistically significant, without re-fitting a completely different model type. This guide covers both functions, the manual formula behind them, how to read chi-squared and F output, and when the Wald test disagrees with the likelihood ratio test.

Key points

  • The Wald test evaluates whether a regression coefficient (or group of coefficients) is significantly different from zero, using only the fitted model's coefficients and their standard errors — no second model required for a single-coefficient test.
  • waldtest() from lmtest compares two nested models and reports an F-statistic; wald.test() from aod tests specific coefficient positions directly and reports a chi-squared statistic. They answer the same underlying question with different output formats.
  • On the mtcars dataset, testing whether disp and hp jointly add explanatory power to a model already containing wt gives F = 5.983, p = 0.0069 — a real, reproducible result you can check against your own R console.
  • The Wald test is computationally cheaper than the Likelihood Ratio Test because it only requires the full model, but it's less reliable in small samples and near-zero coefficients — know when to switch.
Wald test in R using waldtest() and wald.test() functions
Table of Contents

What Is the Wald Test?

Waldtest checks whether one or more coefficients in a fitted regression model are significantly different from a hypothesized value — almost always zero. If a coefficient's estimate is far enough from zero relative to its standard error, the test rejects the null hypothesis that the predictor has no effect. Unlike the Likelihood Ratio Test, which requires fitting two separate models and comparing their log-likelihoods, the Wald test for a single coefficient needs only the model you've already fit.

In practice you'll meet the Wald test in two forms in R: as the t or z column in summary(model) output (that's a Wald test on a single coefficient), and as a standalone function — waldtest() or wald.test() — when you want to test several coefficients at once or compare two nested models directly.

The Wald Test Formula (Manual Calculation)

Before reaching for a function, it helps to see what R is actually computing. For a single coefficient, the Wald statistic is:

Formula:
W = ( (β̂ − β₀) / SE(β̂) )²
Where β̂ is the estimated coefficient, β₀ is the hypothesized value (usually 0), and SE(β̂) is the coefficient's standard error. Under the null hypothesis, W follows a chi-squared distribution with 1 degree of freedom — equivalently, the square root of W is a z-statistic.

Here's the manual version next to R's built-in answer, using the hp coefficient from a model predicting mpg from hp and wt in the mtcars dataset:

model <- lm(mpg ~ hp + wt, data = mtcars)
coef_hp <- coef(model)["hp"]
se_hp   <- summary(model)$coefficients["hp", "Std. Error"]

wald_stat <- (coef_hp / se_hp)^2
p_value   <- pchisq(wald_stat, df = 1, lower.tail = FALSE)

wald_stat
p_value
Verified output: coefficient = −0.0318, SE = 0.0090 → Wald χ² = 12.38, df = 1, p = 0.00043. This matches wald.test(b = coef(model), Sigma = vcov(model), Terms = 2) from the aod package exactly, because that's precisely what the function automates for you.

This manual step is worth doing once. It's the fastest way to understand why the Wald statistic is sensitive to standard error inflation — if SE(β̂) grows (which happens with multicollinearity or small samples), the Wald statistic shrinks even if the coefficient estimate itself hasn't moved, and you can end up failing to reject a null hypothesis that's actually false.

Why Use the Wald Test in R?

R gives you three separate routes to the same test, each suited to a different situation:

Package / FunctionBest forOutput
lmtest::waldtest()Comparing two nested models directly (like anova(), but works for non-nested-in-the-strict-sense comparisons too)F-statistic (or chi-squared with test = "Chisq")
aod::wald.test()Testing specific coefficient positions inside one fitted model, including GLMsChi-squared statistic
car::linearHypothesis()Testing linear combinations or custom constraints on coefficients (e.g., β₁ = β₂)F-statistic or chi-squared

All three require only the model you've already estimated — no re-fitting a restricted model by hand — which is why the Wald test is the default significance check R shows you every time you run summary() on a regression model.

Setting Up: Required Packages

Install and load whichever function fits your task:

packages <- c("lmtest", "aod", "sandwich")
for (pkg in packages) {
  if (!require(pkg, character.only = TRUE)) {
    install.packages(pkg, dependencies = TRUE)
    library(pkg, character.only = TRUE)
  }
}

Info!
lmtest gives you waldtest(). aod gives you wald.test(). sandwich gives you heteroscedasticity-robust standard errors to feed into either function when your residuals aren't well-behaved — see the heteroscedasticity guide for when that matters.

Wald Test with waldtest() — Comparing Nested Models

It is the most common way people search for this function: you have a full model and a reduced model, and you want to know if the extra predictors earn their place.

library(lmtest)

# Full model: predicts mpg from displacement, horsepower, and weight
full_model <- lm(mpg ~ disp + hp + wt, data = mtcars)

# Reduced model: drops disp and hp
reduced_model <- lm(mpg ~ wt, data = mtcars)

waldtest(full_model, reduced_model)
Verified output:
Model 1: mpg ~ disp + hp + wt
Model 2: mpg ~ wt
Res.Df 1 = 28, Res.Df 2 = 30, Df = −2, F = 5.983, Pr(>F) = 0.00686

The p-value of 0.0069 is below 0.05, so you reject the null hypothesis that disp and hp jointly contribute nothing — the full model fits significantly better than the weight-only model. Note that waldtest() defaults to an F-statistic for lm() objects; add test = "Chisq" if you want the chi-squared version instead.

Wald Test with wald.test() — Testing Individual Coefficients

When you want to test one or more specific coefficients inside a single model — without fitting a second, reduced model — aod::wald.test() is the more direct tool.

library(aod)

model <- lm(mpg ~ hp + wt, data = mtcars)

# Test hp and wt jointly (positions 2 and 3 in the coefficient vector)
wald.test(b = coef(model), Sigma = vcov(model), Terms = 2:3)
Verified output: Chi-squared test: X² = 69.2, df = 2, P(> X²) < 0.0001 — both hp and wt are jointly significant predictors of mpg.

Note the difference from the previous section: this X² of 69.2 is the chi-squared equivalent of the earlier F-test on the same two variables, computed against a different baseline model — it tests hp and wt against zero, not against a specific reduced model. Testing a single term works the same way with a single index:

wald.test(b = coef(model), Sigma = vcov(model), Terms = 2)  # hp only
Verified output: Chi-squared test: X² = 12.4, df = 1, P(> X²) = 0.00043 — matches the manual calculation above exactly.

Using Robust Standard Errors

If your residuals show heteroscedasticity, swap the default variance-covariance matrix for a heteroscedasticity-consistent one before testing:

library(sandwich)
robust_se <- vcovHC(model, type = "HC3")
wald.test(b = coef(model), Sigma = robust_se, Terms = 2:3)

Using the robust covariance matrix changes the standard errors feeding into the Wald statistic, which is why the chi-squared value shifts even though the coefficient estimates themselves don't.

Wald Test for Logistic Regression

The Wald test extends directly to logistic regression and other generalized linear models — it's actually the test R runs by default in every summary(glm(...)) output. Using mtcars again, predicting transmission type (am) from horsepower and weight:

logit_model <- glm(am ~ hp + wt, data = mtcars, family = binomial)
summary(logit_model)

wald.test(b = coef(logit_model), Sigma = vcov(logit_model), Terms = 2:3)
Verified output — summary():
hp: coefficient = 0.0363, SE = 0.0177, z = 2.044, p = 0.0409
wt: coefficient = −8.0835, SE = 3.0687, z = −2.634, p = 0.0084

Verified output — wald.test() (joint): Chi-squared test: X² = 6.94, df = 2, P(> X²) = 0.031

Both predictors clear the conventional 0.05 threshold individually, and jointly they're significant at the 5% level too. This is the same z-column you already see in every glm() summary — in a GLM, the "z value" column is a signed square root of the individual Wald chi-squared statistic, so you've been reading Wald test results all along without necessarily naming them that.

Wald Test vs Likelihood Ratio Test vs F-Test

These three tests frequently get confused because in ordinary linear regression with normal errors, the Wald test and the F-test are mathematically identical — that's why waldtest() on an lm() object returns an F-statistic. The differences show up once you move to GLMs or small samples.

FeatureWald TestLikelihood Ratio Test (LRT)F-Test
Models requiredOne (the full model)Two (full and reduced)One or two, depending on use
Test statisticChi-squared (or z)Chi-squared (−2 × log-likelihood ratio)F-distribution
Computational costLow — one model fitHigher — two model fitsLow, exact for linear models
Small-sample behaviorCan be unreliable; not invariant to reparameterizationGenerally preferred, more stableExact under normal-error linear regression
Typical useQuick coefficient significance checks, large samplesNested GLM comparisons, small-to-moderate samplesNested linear model comparisons
Warning! For linear regression specifically, Wald and F-test results are equivalent — use whichever function is more convenient. For logistic and other GLMs, they can disagree in finite samples even though both converge to the same answer as sample size grows. If your Wald and LRT p-values land on opposite sides of 0.05 in a GLM, trust the Likelihood Ratio Test — it doesn't share the Wald test's near-zero-coefficient instability.

When to Use Each Test

  1. Use the Wald test for a fast significance check on coefficients you've already estimated, especially with large samples.
  2. Use the Likelihood Ratio Test for logistic or other GLM model comparisons, or whenever a coefficient estimate sits close to zero — the Wald statistic becomes unreliable exactly where you need it most.
  3. Use the F-test for nested linear model comparisons when you want an exact (not asymptotic) test — see the F-test in R guide for variance-comparison cases specifically.

Interpreting Chi-Squared Output

Every Wald test result gives you a chi-squared (or F) statistic and a p-value. Here's what each piece means and how the degrees of freedom are decided:

Output elementWhat it tells you
Chi-squared (X²) valueHow far the coefficient estimate sits from the hypothesized value, scaled by its standard error. Larger = stronger evidence against the null.
Degrees of freedom (df)The number of coefficients being tested simultaneously — 1 for a single coefficient, 2+ for a joint test.
P(> X²) / p-valueThe probability of seeing a chi-squared value this large if the null hypothesis (coefficient = 0) were actually true.
Common misread: A high chi-squared value with a low p-value means you reject the null and treat the predictor as significant. A low chi-squared value with a high p-value means you fail to reject the null — it does not prove the predictor has zero effect, only that this test found insufficient evidence against zero. Check the confidence interval alongside the p-value before concluding a variable is irrelevant.

Common Pitfalls

  1. Treating "not significant" as "no effect." Failing to reject H₀ means the data didn't provide enough evidence — not that the true effect is zero. Small samples make this mistake especially easy.
  2. Ignoring near-zero coefficients. The Wald test's standard errors become unstable when a coefficient sits close to zero, which can inflate or deflate the statistic unpredictably. Switch to the Likelihood Ratio Test if this applies to you.
  3. Skipping the assumption check. Wald tests on lm() objects assume homoscedastic, roughly normal residuals. Violations don't invalidate the test outright, but they do mean you should use vcovHC() robust standard errors, as shown above.
  4. Confusing statistical and practical significance. A significant Wald test tells you a coefficient probably isn't zero — it says nothing about whether the effect size is large enough to matter for your decision.

Conclusion

The Wald test in R gives you two direct routes to the same underlying question — is this predictor, or this group of predictors, pulling its weight in the model? waldtest() from lmtest compares nested models with an F-statistic; wald.test() from aod tests specific coefficients with a chi-squared statistic; both trace back to the same manual formula. For linear models the Wald test and F-test agree exactly. For logistic regression and other GLMs, or whenever a coefficient sits close to zero, cross-check against the Likelihood Ratio Test before trusting the result on its own.

Frequently Asked Questions (FAQs)

What does the Wald test do in R?

It tests whether a regression coefficient (or group of coefficients) differs significantly from zero, using the coefficient estimate and its standard error. Use waldtest() from lmtest to compare two nested models, or wald.test() from aod to test specific coefficient positions inside one fitted model.

What is the formula for the Wald test?

For a single coefficient: W = ((β̂ − β₀) / SE(β̂))², where β̂ is the estimated coefficient, β₀ is the hypothesized value (usually 0), and SE(β̂) is its standard error. W follows a chi-squared distribution with 1 degree of freedom under the null hypothesis.

How do you interpret a Wald chi-square value?

A larger chi-squared value means the coefficient sits further from the hypothesized value relative to its uncertainty, giving stronger evidence against the null hypothesis. Read it together with the p-value: p < 0.05 conventionally means you reject the null and treat the coefficient as statistically significant.

Is the Wald test the same as a chi-square test?

The Wald test statistic follows a chi-squared distribution under the null hypothesis, especially when testing multiple coefficients jointly, so R's wald.test() reports it as a chi-squared test. For a single coefficient, its square root is equivalent to a z-statistic.

Is the Wald test an F-test?

In ordinary linear regression, the Wald test and F-test give identical results, which is why waldtest() on an lm() object returns an F-statistic by default. In logistic regression and other GLMs they are asymptotically equivalent but not numerically identical in finite samples.

What is the difference between the Wald test and the Likelihood Ratio Test?

The Wald test only requires the full (unrestricted) model, while the Likelihood Ratio Test requires fitting both a full and a reduced model and comparing their log-likelihoods. LRT is generally more reliable in small samples and near-zero coefficients; the Wald test is cheaper to compute.

How do you run a Wald test for logistic regression in R?

Fit the model with glm(y ~ x, family = binomial), then call wald.test(b = coef(model), Sigma = vcov(model), Terms = ...) from the aod package, specifying the coefficient positions to test. The z-values in summary(glm(...)) are the single-coefficient version of the same test.

What is the null hypothesis in a Wald test?

The null hypothesis is that the coefficient (or set of coefficients) being tested equals the hypothesized value — almost always zero, meaning the predictor has no effect on the outcome. A significant result rejects this and supports keeping the predictor in the model.

What is the difference between a t-test and a Wald test?

A t-test evaluates a single coefficient using the t-distribution, which accounts for extra uncertainty in small samples. The Wald test uses a chi-squared (or z) distribution and can test single or multiple coefficients jointly, making it the more general tool for larger samples and GLMs.

Why is my Wald test not significant when the coefficient looks large?

A large coefficient with a large standard error can still produce a small Wald statistic, because the test divides the coefficient by its standard error before squaring. This is common with multicollinearity, small samples, or near-zero coefficients — check vcovHC() robust standard errors or switch to the Likelihood Ratio Test.

📊

Need this analysis done for your thesis or dissertation? I'll handle it in R, SPSS, or Minitab — with APA-formatted results delivered fast.