PaulB
PaulB

Reputation: 319

Stata: Choose which interaction to omit using factor variables and fixed effects

Using factor variables in Stata in a regression it's easy to choose which main effect to omit. However, as in the below example, sometimes I wish to choose which additional collinear factor variable to omit, where here the collinearity is due to the fixed effects. I thought the ib4 notation would do it, but Stata seems to ignore this, instead omitting the interaction between indicators for treat=1 and t=8. How can I force omission of the interaction between indicators for treat=1 and t=4?

clear
set obs 100
gen id=_n
gen treat=runiform()>.5
expand 8
bysort id: gen t=_n
gen y_0=rnormal()+3*t
gen y_1=rnormal()+5*t+5
gen post=t>4
gen posttreat=post*treat
gen y=cond(posttreat==1,y_1,y_0)
areg y ib4.t i.treat#ib4.t, absorb(id)

Upvotes: 0

Views: 2263

Answers (1)

dimitriy
dimitriy

Reputation: 9460

Try

areg y i.treat##ib4.t, absorb(id)

Upvotes: 1

Related Questions