Announcement

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

  • Interaction term

    Hi Everyone!

    I try to run a regression with an interaction variable in Stata. The interaction term consists of a dummy (value either 0 or 1) and a normal variable. However, the coefficient gives the value 0 or 1.
    What am I doing wrong?

    Thanks in advance!
    Vera

  • #2
    without showing EXACTLY the command you used, and possibly providing a data example (using -dataex- and CODE blocks), it is not possible to answer your question; please read the FAQ and try again

    Comment


    • #3
      Okay I will try to be more clear.

      First of all, I tried to generate an interaction term with the following command:
      generate Emorec1=Happy*Recency1
      generate Emorec2=Happy*Recency2

      Happy is the dummy variable and if it is happy it has the value 1 and if it is sad it gets the value 0.
      Recency is a variable that reflects the return.

      Afterwards I try to run the regression and I get the following result:
      I can't upload the image, but I typed in regress Recency1 Happy Emorec1
      And I obtained a coefficient of 0.193435 for the variable Happy
      And a coefficient of 1 for the variable Emorec1

      However, the coefficient Emorec1 shouldn't be 1.
      Last edited by Vera van Oijen; 07 Jun 2021, 06:28.

      Comment


      • #4

        . regress Recency2 Happy Emorec2

        Source | SS df MS Number of obs = 213
        -------------+---------------------------------- F(2, 210) = 252.85
        Model | 9.63195739 2 4.81597869 Prob > F = 0.0000
        Residual | 3.99990196 210 .019047152 R-squared = 0.7066
        -------------+---------------------------------- Adj R-squared = 0.7038
        Total | 13.6318594 212 .064301223 Root MSE = .13801

        ------------------------------------------------------------------------------
        Recency2 | Coef. Std. Err. t P>|t| [95% Conf. Interval]
        -------------+----------------------------------------------------------------
        Happy | -.0017099 .018916 -0.09 0.928 -.0389994 .0355796
        Emorec2 | 1 .0444796 22.48 0.000 .9123163 1.087684
        _cons | .0017099 .0133421 0.13 0.898 -.0245916 .0280115
        ------------------------------------------------------------------------------

        Comment


        • #5
          Interaction model does not operate this way. Usually it involves at least three variables: the dependent (y), and two independent variables (x1, x2). An interaction model would look like:

          Code:
          y = b0 + b1*x1 + b2*x2 + b3*(x1*x2)
          In your case, you're predicting a variable with an interaction term derived from it, kind of like:

          Code:
          x1 = b0 + b1*x2 + b2*(x1*x2)
          Because the values in (x1*x2) is the same as x1 when x2 == 1, that means it's partially identical to x1 when it's not 0, so the best-fit coefficient is 1.
          Last edited by Ken Chui; 07 Jun 2021, 08:04.

          Comment

          Working...
          X