In the following model I want to create a contrast matrix (K) corresponding to the global null hypothesis that all interaction terms present in the model are zero and test both the global hypothesis and all hypotheses corresponding to each of the interaction terms. Can model matrix be used as a contrast matrix in this case?

clouds_formula <- rainfall ~ seeding + seeding:(sne + cloudcover + prewetness + echomotion) + time
clouds_lm <- lm(clouds_formula, data = clouds)

K <- model.matrix(clouds_formula, data = clouds) # contrast matrix
summary(glht(clouds_lm, linfct=K))

1 Answer 1


Here's a starting point. Get the model matrix for this model, and also the model matrix for the model without the interaction terms that you wish to test. Look at the row spaces of each. You need to get what's in the row space of the bigger model that isn't part of the row space of the simpler model. Does that help?


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.