Let us say I am interested in analyzing an event, which takes place at year 0. My variables are the years since the event: years before the event are coded as "negative" years (so the year before the event is year -1, the year before that is -2, etc). And years after the event are the "positive years": the year after is year 1, etc. For simplicity, assume these are the only explanatory variables I have in the model.
Imagine I have a dependent variable x, and I want to run the following regression, where y corresponds to the number of years since the event:
lm(x ~ y + y^2, data = mydata)
As you can see, I want to encode the quadratic of years since the event. However, for negative years y, the variable y^2 will be positive if I square it: so for y^2, there will be no differentiation between years before and after the event. My question is whether I should simply do y^2 * (-1) for negative years (and ONLY for negative years) to remidy this. Is this the correct approach? Or am I doing something econometrically wrong here?
Thank you in advance!
y^2. What you describe is something different. Neither is wrong -- it depends on what you want to accomplish. But you haven't given us any information to help you decide. β whuber Aug 03 '21 at 02:14