I'm trying to conduct a joint test of significance in a seemingly unrelated regression setup with robust standard errors. I have three outcomes Y1
, Y2
, and Y3
and I want to conduct a joint hypothesis test against the null that the average effect of the treatment Z
is zero on all three outcomes.
I think that I have the model set up correctly, but I don't think that I have the hypothesis.matrix
set correctly in car::linearHypothesis
.
Here's some data:
library(tibble)
library(car)
library(systemfit)
set.seed(343)
N = 800
dat <-
tibble(
U = rnorm(N),
Z = rbinom(N, 1, 0.5),
Y = 0.2 * Z + U,
Y1 = Y + rnorm(N, sd = 0.3),
Y2 = Y + rnorm(N, sd = 0.5),
Y3 = Y + rnorm(N, sd = 0.5)
)
Here's the seemingly unrelated regression fit:
sur <- systemfit(list(Y1 ~ Z, Y2 ~ Z, Y3 ~ Z), method = "SUR", data = dat)
summary(sur)
Which is identical to the ols fit in this case:
ols <- lm(cbind(Y1, Y2, Y3) ~ Z, data = dat)
summary(ols)
Which is useful, because I need to estimate robust standard errors for this test:
linearHypothesis(ols, hypothesis.matrix = "Z = 0", white.adjust = "hc2")
This last line is the one that I think is incorrect. I think it's incorrect because the individual coefficients all have lower p-values than the joint test, but I could be wrong?
Looks right to me. You'd get the same result by estimating the null model (
ols0
below) and usinganova()
to test the difference between the estimated and null models.Created on 2022-07-08 by the reprex package (v2.0.1)