For example, if I have Y = b0 + b1X1 + b2X2 + b3X3 + b4X4, I want to test H0: b1 = b3 = 0, at alpha = 0.05.

I ran an lm model in R and got the p-values for each coefficient and the overall F statistic, but I'm not sure what to do to test them simultaneously.


In your case, you want to know if the coefficients are equal to $0$. A model where the coefficients are $0$ is the same as a model that does not include those variables. Thus, you can perform a nested model test of a reduced model without those variables versus a full model that includes all the variables.

In a linear model context, that is called an $F$-change test, or $R^2$-change test, because you can compute the test value from the $F$ (or $R^2$) statistics from the two models (it is also sometimes called a 'multiple partial $F$ test, and by a dozen other names). I show a version of the formula here: Testing for moderation with continuous vs. categorical moderators. In a non-linear context (e.g., a logistic regression model), a likelihood ratio test can be used. More generally, testing multiple parameters at the same time is called a simultaneous test or a chunk test.

Concretely, to do this in R you would do something like:

m.full    = lm(Y~X1+X2+X3+X4)
m.reduced = lm(Y~X2+X4)
anova(m.reduced, m.full)

I will illustrate for models with one and two regressors, the generalization to four variables should be obvious.

y <- rnorm(100)
x1 <- rnorm(100)
x2 <- rnorm(100)

reg1 <- lm(y~x1)
reg2 <- lm(y~x1+x2)

So, load the lmtest package (the next three lines just create some example data), run the restricted regession reg1, the unrestricted one reg2 and let waldtest do the comparison for you.

For my random numbers, I get the following output:

Wald test

Model 1: y ~ x1
Model 2: y ~ x1 + x2
  Res.Df Df      F Pr(>F)
1     98                 
2     97  1 0.0178 0.8942

Thus, the null that $\beta_2=0$ cannot be rejected at $\alpha=0.05$, as the $p$-value Pr(>F) is way larger. This is not surprising in view of how I generated the data: there s no relationship between the x and y.

  • 1
    $\begingroup$ There is also the package car which allows to do the test without setting up the restricted model by oneself, e.g. for b1 = b3 = 0: car::linearHypothesis(reg, c("x1", "x3"), c(0,0), test = "F") $\endgroup$ – Helix123 Jun 3 '17 at 7:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.