Announcement

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

  • Interaction effect between two variables. What is the difference between ## and #

    Dear Professors,

    I would like to test four interaction effect between variables in random effect model: which are

    interaction effect between total and
    (i) fd (continuous)
    (ii) fceo (dummy, 0 and 1)

    AND

    interaction effect between id and
    (i) dis (continuous)
    (ii) fis (continuous)

    I noticed that ## and # give different results


    . xtreg lnexrem c.fd##c.total i.fceo##c.total c.id##c.dis c.id##c.fis idat rd idrc bs lnta lev laggedroa mv mccg, re
    note: total omitted because of collinearity
    note: id omitted because of collinearity

    Random-effects GLS regression Number of obs = 1395
    Group variable: code Number of groups = 279

    R-sq: within = 0.1756 Obs per group: min = 5
    between = 0.3982 avg = 5.0
    overall = 0.3750 max = 5

    Random effects u_i ~ Gaussian Wald chi2(19) = 417.87
    corr(u_i, X) = 0 (assumed) Prob > chi2 = 0.0000

    ------------------------------------------------------------------------------
    lnexrem | Coef. Std. Err. z P>|z| [95% Conf. Interval]
    -------------+----------------------------------------------------------------
    fd | .0238029 .6082261 0.04 0.969 -1.168298 1.215904
    total | -.3255308 .6907759 -0.47 0.637 -1.679427 1.028365
    |
    c.fd#c.total | .3000803 1.284027 0.23 0.815 -2.216567 2.816727
    |
    1.fceo | -.2763074 .2369025 -1.17 0.243 -.7406278 .188013
    total | (omitted)
    |
    fceo#c.total |
    1 | .7582793 .4858597 1.56 0.119 -.1939883 1.710547
    |
    id | -.4038776 .3000665 -1.35 0.178 -.9919971 .1842419
    dis | -1.091215 .7278848 -1.50 0.134 -2.517843 .3354127
    |
    c.id#c.dis | 1.965933 1.654194 1.19 0.235 -1.276228 5.208094
    |
    id | (omitted)
    fis | .2268854 1.233252 0.18 0.854 -2.190245 2.644016
    |
    c.id#c.fis | -.9240375 2.691288 -0.34 0.731 -6.198865 4.35079
    |
    idat | -.0009001 .0050679 -0.18 0.859 -.0108329 .0090327
    rd | .0819277 .0515627 1.59 0.112 -.0191333 .1829887
    idrc | .018694 .1047622 0.18 0.858 -.186636 .224024
    bs | .0728553 .0141188 5.16 0.000 .0451829 .1005277
    lnta | .4132528 .0309636 13.35 0.000 .3525652 .4739404
    lev | -.2044981 .1224848 -1.67 0.095 -.444564 .0355677
    laggedroa | .0029332 .0020636 1.42 0.155 -.0011112 .0069777
    mv | .0647557 .0215945 3.00 0.003 .0224313 .1070801
    mccg | .1190974 .0194464 6.12 0.000 .0809831 .1572116
    _cons | 8.732723 .5140285 16.99 0.000 7.725246 9.740201
    -------------+----------------------------------------------------------------
    sigma_u | .71427335
    sigma_e | .32818334
    rho | .82569037 (fraction of variance due to u_i)
    ------------------------------------------------------------------------------




    . xtreg lnexrem c.fd#c.total i.fceo#c.total c.id#c.dis c.id#c.fis idat rd idrc bs lnta lev laggedroa mv mccg, re

    Random-effects GLS regression Number of obs = 1395
    Group variable: code Number of groups = 279

    R-sq: within = 0.1732 Obs per group: min = 5
    between = 0.3953 avg = 5.0
    overall = 0.3722 max = 5

    Random effects u_i ~ Gaussian Wald chi2(14) = 413.80
    corr(u_i, X) = 0 (assumed) Prob > chi2 = 0.0000

    ------------------------------------------------------------------------------
    lnexrem | Coef. Std. Err. z P>|z| [95% Conf. Interval]
    -------------+----------------------------------------------------------------
    c.fd#c.total | .5946801 .4266258 1.39 0.163 -.2414911 1.430851
    |
    fceo#c.total |
    0 | .0332837 .3361273 0.10 0.921 -.6255136 .6920811
    1 | .2454874 .3161734 0.78 0.437 -.374201 .8651758
    |
    c.id#c.dis | -.5056158 .5649353 -0.89 0.371 -1.612869 .601637
    |
    c.id#c.fis | -.6130954 .8468996 -0.72 0.469 -2.272988 1.046797
    |
    idat | -.0002822 .0049735 -0.06 0.955 -.0100302 .0094657
    rd | .0760973 .0512811 1.48 0.138 -.0244119 .1766064
    idrc | .0028356 .1006021 0.03 0.978 -.194341 .2000122
    bs | .0769993 .013667 5.63 0.000 .0502124 .1037862
    lnta | .4148468 .0306303 13.54 0.000 .3548125 .4748812
    lev | -.210979 .1220482 -1.73 0.084 -.450189 .028231
    laggedroa | .0029897 .0020568 1.45 0.146 -.0010416 .007021
    mv | .0652235 .0215337 3.03 0.002 .0230183 .1074287
    mccg | .1175888 .019318 6.09 0.000 .0797261 .1554514
    _cons | 8.282248 .3928169 21.08 0.000 7.512341 9.052155
    -------------+----------------------------------------------------------------
    sigma_u | .71332933
    sigma_e | .32805932
    rho | .82541831 (fraction of variance due to u_i)
    ------------------------------------------------------------------------------

    Could you please advise which one to use? ## or #?

    I sincerely look forward to receiving favorable assistance. Thank you.





  • #2
    Jong Ling:
    welcome to the list.
    What you're interested is comprhensively covered in -help fvvarlist- and related entry in Stata .pdf manual.
    That said, whereas -#- asks Stata to calculate only the interaction between two (or more) predictors, -##- calculates both interaction and the main conditional effects of the predictors included in the intearction itself.
    Most of the times (as in your case), researcher should prefer -##- notation.
    Kind regards,
    Carlo
    (Stata 19.0)

    Comment


    • #3
      Dear Professor Carlo,

      Many thanks for your prompt response. I sincerely appreciate that.

      When trying to create the interaction effect between two variables, I notice that there are several options, such as Interaction (2-way) and 2-way full factorial. May I know what is the difference between these two options and which one is better?

      Thank you.

      Comment


      • #4
        Jong Ling:
        please call Carlo as all on (and many more off) the list do.
        The best source for the topic(s) you're interested in is -help fvvarlist- and related entry in Stata .pdf manual.
        In brief, the -fvvarlst- operators -i- and -c- tell Stata that the variables included in the interactions are categorical or continuous.
        Kind regards,
        Carlo
        (Stata 19.0)

        Comment


        • #5
          Dear Carlo,

          Well noted. Thank you very much.

          Comment

          Working...
          X