I'm having difficulties to find the right model formula for my model:
$Y_i=a+bX_i$ where Y and X are both deflated by another variable
y1/def ~ x1/def + x2/def
returns a model with interactions. How can i prevent R from doing so?
Cross Validated is a question and answer site for people interested in statistics, machine learning, data analysis, data mining, and data visualization. It only takes a minute to sign up.Sign up to join this community
If you want to perform a transformation on the variables in the regression, you'll have to use the
I(y1/def) ~ I(x1/def) + I(x2/def)
Try that instead and see if it works the way you want it to...
Basically, you use the
I() function in a formula whenever you want an expression to be treated "as is". For example, if you have a data frame with three columns, a, b, & c, and you want to regress c onto the sum of columns a and b you would write:
c ~ I(a + b) since--as you've seen yourself--entering:
c ~ a + b would give you a totally different regression.