1
$\begingroup$

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?

$\endgroup$
3
  • $\begingroup$ Did this help you get the desired behavior? $\endgroup$
    – Steve S
    Jul 29, 2014 at 6:48
  • $\begingroup$ As a word of caution, be careful with dividing by def, however--if it's a random variable then dividing both sides by def could completely change the functional form of your regression. Just throwing that out there... $\endgroup$
    – Steve S
    Jul 29, 2014 at 7:36
  • $\begingroup$ Thank you for your answer and the hints on deflating. I wasnt able to check yet. Will comment when I did so. $\endgroup$
    – Gritti
    Jul 29, 2014 at 14:52

1 Answer 1

4
$\begingroup$

If you want to perform a transformation on the variables in the regression, you'll have to use the I() function:

I(y1/def) ~ I(x1/def) + I(x2/def)

Try that instead and see if it works the way you want it to...

Explanation:

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.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.