Kate:
not quite.
By implementing Wouter's helpful advice, you will actually obtain an interaction between a continuous and categorical variable that works as you surmised, but instead of producing an indicator, gives back different coefficients (ie, the so called main conditional effects along with the interaction in proper sense).
That said, one of the most helpful approach that I know (to which I return whenever it's a while I ran my last interaction) implies retrieving the fitted values from Stata and then challenging myself with (re)calculating the fitted values on the grounds of regression results, as you can see in the following toy-example:
not quite.
By implementing Wouter's helpful advice, you will actually obtain an interaction between a continuous and categorical variable that works as you surmised, but instead of producing an indicator, gives back different coefficients (ie, the so called main conditional effects along with the interaction in proper sense).
That said, one of the most helpful approach that I know (to which I return whenever it's a while I ran my last interaction) implies retrieving the fitted values from Stata and then challenging myself with (re)calculating the fitted values on the grounds of regression results, as you can see in the following toy-example:
Code:
use "https://www.stata-press.com/data/r16/nlswork.dta" . xtreg ln_wage c.age##i.nev_mar, fe Fixed-effects (within) regression Number of obs = 28,494 Group variable: idcode Number of groups = 4,710 R-sq: Obs per group: within = 0.1088 min = 1 between = 0.0889 avg = 6.0 overall = 0.0797 max = 15 F(3,23781) = 968.10 corr(u_i, Xb) = 0.0248 Prob > F = 0.0000 ------------------------------------------------------------------------------- ln_wage | Coef. Std. Err. t P>|t| [95% Conf. Interval] --------------+---------------------------------------------------------------- age | .0156629 .0004015 39.01 0.000 .0148759 .0164499 1.nev_mar | -.3109508 .0246842 -12.60 0.000 -.3593333 -.2625682 | nev_mar#c.age | 1 | .0114433 .0010241 11.17 0.000 .009436 .0134506 | _cons | 1.225069 .0124108 98.71 0.000 1.200743 1.249395 --------------+---------------------------------------------------------------- sigma_u | .40596052 sigma_e | .30238524 rho | .64316049 (fraction of variance due to u_i) ------------------------------------------------------------------------------- F test that all u_i=0: F(4709, 23781) = 8.85 Prob > F = 0.0000 . predict xb, fitted option fitted not allowed r(198); . predict fitted, xb (40 missing values generated) . list idcode ln_wage age nev_mar fitted in 1 +---------------------------------------------+ | idcode ln_wage age nev_mar fitted | |---------------------------------------------| 1. | 1 1.451214 18 1 1.40203 | +---------------------------------------------+ . di 1.225069 + (.0156629+.0114433)*18 -.3109508 1.4020298 . list idcode ln_wage age nev_mar fitted in 2 +---------------------------------------------+ | idcode ln_wage age nev_mar fitted | |---------------------------------------------| 2. | 1 1.02862 19 0 1.522664 | +---------------------------------------------+ . di 1.225069 + (.0156629)*19 1.5226641 .
Comment