Hello R-Helpers, I was looking into how to test whether the beta coefficient from a regression would be the same for two different groups contained in the dataset for the regression.
When I put that question into google, AI returned a very nice looking answer (and a couple of variations on it). library(car) data <- data.frame(income = c(30, 45, 50, 25, 60, 55), education = c(12, 16, 14, 10, 18, 16), gender = c("Male", "Female", "Male", "Female", "Male", "Female")) model <- lm(income ~ education * gender, data = data) # Test if the beta for "education" is significantly different between genders test <- linearHypothesis(model, "genderMale - genderFemale = 0") print(test) This, however, produces an error that I can't find a way to resolve. Can this test actually be done in this manner, or is this a case of AI run amok. Guidance would be appreciated. --John Sparks [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide https://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.