Skip to main content
added 213 characters in body
Source Link

By interaction term do you mean a higher order term? So instead of:

fit <- lm(y ~ x1 + x2, data = mydata)

You can do

fit <- lm(y ~ x1 + x2 + x1*x2, data = mydata)

(looking back at this answer it's probably not what you looking for. I would suggest trying setting your sex variable to be -1 or 1, this way at least the mean of the product term between sex and age is zero.)

By interaction term do you mean a higher order term? So instead of:

fit <- lm(y ~ x1 + x2, data = mydata)

You can do

fit <- lm(y ~ x1 + x2 + x1*x2, data = mydata)

By interaction term do you mean a higher order term? So instead of:

fit <- lm(y ~ x1 + x2, data = mydata)

You can do

fit <- lm(y ~ x1 + x2 + x1*x2, data = mydata)

(looking back at this answer it's probably not what you looking for. I would suggest trying setting your sex variable to be -1 or 1, this way at least the mean of the product term between sex and age is zero.)

Source Link

By interaction term do you mean a higher order term? So instead of:

fit <- lm(y ~ x1 + x2, data = mydata)

You can do

fit <- lm(y ~ x1 + x2 + x1*x2, data = mydata)