Hi all and Ariel Linden

I was going through the UCLA page on how to do peicewise regression in Stata https://stats.idre.ucla.edu/stata/fa...sion-in-stata/

I'm interested in including a treatment and time interaction term, but not sure how. The iitsa command by Ariel Linden says the model for one group under study is:

Y_t = Beta_0 + Beta_1(T) + Beta_2(X_t) + Beta_3(TX_t)

Here Y_t is the aggregated outcome variable measured at each equally spaced time point t, T is the time
since the start of the study, X_t is a dummy (indicator) variable representing the intervention
(preintervention periods 0, otherwise 1), and TX_t is an interaction term


How do I manually fit this regression equation above with the below data
Code:
use https://stats.idre.ucla.edu/stat/stata/faq/talk, clear
 
generate age1 = (age - 14)  
replace  age1 = 0 if age >= 14
generate age2 = (age - 14)  
replace  age2 = 0 if age < 14  

generate int1 = 1
replace  int1 = 0 if age >= 14
generate int2 = 1
replace  int2 = 0 if age < 14  

regress talk int1 int2 age1 age2, hascons  

predict yhat  
twoway (scatter talk age)  (line yhat age if age <14, sort) (line yhat age if age >=14, sort), xline(14)
Thank you