I am running a multiple regression on simulated data in R. The sample size is 100. There is one relevant regressor and 18 irrelevant ones. I am testing the joint significance of the 18 irrelevant regressors using Newey-West covariance matrix.
Puzzle 1: I find the 18 irrelevant regressors to be highly statistically significant.
Puzzle 2: I get a test statistic of 6.8814
under 18
degrees of freedom which seems moderate to me (not far out in the right tail of the F(18, 80)
distribution), so how come this yields a very low p-value of 4.5e-10
?
I was able to figure out puzzle 1. Apparently, Newey-West is the problem. Using vanilla covariance matrix, the result is much more sensible. However, I am still at a loss w.r.t. puzzle 2, and that is my question.
library(car)
library(sandwich)
m <- 20
n <- 100
set.seed(9999)
x <- rnorm(m * n)
X <- matrix(x, ncol = m)
X[, 2] <- X[, 1] + X[, 2]
# Now the 2nd column is the 1st column + some noise,
# while all the other columns are pure noise.
# Thus, if we try to predict the 1st column, then only the 2nd column should be helpful.
m1 <- lm(X[, 1] ~ X[, -1])
(test <- linearHypothesis(
model = m1,
hypothesis.matrix = (diag(m)[-c(1:2), ]),
rhs = rep(0, m - 2),
test = "F",
vcov. = NeweyWest(m1)
))
Result:
Linear hypothesis test
Hypothesis:
Model 1: restricted model
Model 2: X[, 1] ~ X[, -1]
Note: Coefficient covariance matrix supplied.
Res.Df Df F Pr(>F)
1 98
2 80 18 6.8814 4.494e-10 ***
Without the Newey-West:
(test <- linearHypothesis(
model = m1,
hypothesis.matrix = (diag(m)[-c(1:2), ]),
rhs = rep(0, m - 2),
test = "F"
))
Result:
Linear hypothesis test
Hypothesis:
Model 1: restricted model
Model 2: X[, 1] ~ X[, -1]
Res.Df RSS Df Sum of Sq F Pr(>F)
1 98 38.856
2 80 31.982 18 6.8739 0.9552 0.5178
Edit 1: Thank you to Lukas Lohse for a good comment. When evaluating the size of the test statistic informally, I was thinking of the $\chi^2$ approximation to the $F$ distribution but forgot that I have to multiply the $F$ value by the numerator degrees of freedom (here, 18) to get the corresponding $\chi^2$ statistic... OK, so instead of puzzle 2 we now have a new puzzle 3: why does the test with Newey-West use 6.8 as the $F$-statistic and the one with vanilla variance estimator as the sum of squares.
Edit 2: It looks like puzzle 3 was based on a coincidence where the $F$-statistic and the sum of squares just happened to be close. Lukas Lohse has the answer.