I am fitting a logistic model to data using the glm function in R. I have attempted to specify interaction terms in two ways:
fit1 <- glm(y ~ x*z, family = "binomial", data = myData) fit2 <- glm(y ~ x/z, family = "binomial", data = myData)
I have 3 questions:
- What is the difference between specifying my interaction terms as
When I call
summary(fit1) the report includes results for the intercept, x, z, and x:z while
summary(fit2) only includes results for intercept, x, and x:z.
I did look at Section 11.1 in "An Introduction to R" but couldn't understand the meaning.
- How do I interpret the fit equation mathematically? Specifically, how do I interpret the interaction terms formulaically?
Moving to math instead of R, do I interpret the equation as:
logit(y) = (intercept) + (coeff_x)*x + (coeff_z)*x + (coeff_xz)*x*z ?
This interpretation may differ in the two specifications
fit2. What is the interpretation of each?
- Assuming the above interpretation is correct, how to I fit the model of x*(1/z) in R? Do I need to just create another column with these values?