1

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!

  • Sticking the $-1$ out in front makes all of the negative, so it’s the same issue as you would have without that coefficient. – Dave Aug 03 '21 at 00:29
  • Thanks. I meant that I can multiply the square of ONLY the negative years by -1. Sorry if that wasn't clear, I'll edit it. – Student In Need Aug 03 '21 at 01:53
  • It isn't clear what you want to do. A quadratic term in years is specified by 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

0 Answers0