I am trying to run a joint significance test in R:
library(car)
data("mtcars")
mylm <- lm(mpg ~ qsec + gear + am + am:qsec + am:hp, data=mtcars)
linearHypothesis(mylm, c("am + am:qsec + am:hp"))
But I always end up with this error:
Error in constants(lhs, cnames_symb) :
The hypothesis "am + am:qsec + am:hp" is not well formed: contains bad coefficient/variable names.
What I am trying to test is whether
am + am:qsec + am:hp = 0
I have found in the documentation how to test for all interaction terms:
linearHypothesis(mylm, matchCoefs(mylm, ":"), verbose=TRUE)
But I want to test interaction terms and level terms together. Is this possible?