Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • variables prefix

    Hello everyone,

    Is there a difference between creating new interaction variables or using the prefixes of the factor variables i. and c.?

    So far, I have always preferred to create variables in the dataset and then insert them into regressions, but I have seen many users using prefixes to create interaction variables.
    From what I understand, there should be no difference, but I have tested on my dataset and the results are different. Am I doing something wrong, or is there a difference between the two methods?

    Code:
    xtreg AR GDP_dev ceqi T TxGDP Txceqi, fe
    Code:
    xtreg AR GDP_dev ceqi T i.T##c.GDP_dev i.T##c.ceqi, fe
    These two regressions give me different results. T is the treatment dummy, while GDP and ceqi are the two variables it should interact with.

    Thanks!

  • #2
    i.var defines a categorical variable "var". If you multiply two variables, that represents a continuous by continuous interaction, so

    Code:
    xtreg AR GDP_dev ceqi T TxGDP Txceqi, fe
    is exactly

    Code:
    xtreg AR c.T##c.GDP_dev c.T##c.ceqi, fe
    See

    Code:
    help fvvarlist
    for more.

    Comment


    • #3
      Thank you for the answer. My confusion stems from the fact that i. is used in front of dummy but categorical, which is another case then my treatment effect.

      Comment


      • #4
        An indicator (dummy) has two levels. As you cannot include both levels as they are collinear with the intercept, it matters not whether you prefix it with i. or c. in terms of the estimation.

        Comment


        • #5
          I would add that some commands presuppose that you used factor variable notation in fitting your model.

          Comment

          Working...
          X