For the life of me I cannot figure out how to run a multiple linear regression with two predictors interacted without also regressing on the interacted predictors by themselves. Here is an example:
When I use this script to do a regression
lagfit <- lm(formula = Production ~ DayOfWeek*Employees, data = train)
It returns a regression with three predictors: day of week, # of employees, and the interaction. But I only want to regress on the interaction. How can I do this?
You can just use the :
operator instead of *
:
lagfit <- lm(formula = Production ~ DayOfWeek:Employees, data = train)