Hi there
I am having a problem with including interaction terms in my panel data fixed effects model, and I would be grateful for any help:
I am working with panel data where ID identifies a specific individual across waves. I am studying the effect of different unemployment durations on my dependent variable (y). I have numerous dummy variables representing different durations of unemployment (unemp_lessthan4mths unemp_4to8mths unemp_8to12mths unemp_1to2yrs), and also a dummy variable for sex. I want to compare the coefficients on the unemployment durations between male and females.
I can get coefficients for each group by typing:
(a)
However, I realised I don't think I can test for the coefficients being statistically significantly different if they are in separate regression, because 'suest' can't be used with panel data (please correct me if I am wrong)
So I tried creating a series of interaction terms:
My understanding is that this should have produced the same coefficients for unemp_lessthan4mths unemp_4to8mths unemp_8to12mths unemp_1to2yrs as when sex=0, and the coefficients of the interaction term should have been the difference between the coefficients when sex=1 and when sex=0.
However, Stata does not seem to do this. Instead the coefficients produced when unemp_lessthan4mths unemp_4to8mths unemp_8to12mths unemp_1to2yrs are not part of an interaction term are not the same as those produced when regressing either group alone(as in (a) above). And the interaction term coefficients are not the difference between the two coefficients in (a)
Also, the following odd things happen:
1) I get the messages note: "1.sex omitted because of collinearity" and "note: sex omitted because of collinearity"
2) Stata puts a ''1.'' in front of all the variables (unemp_lessthan4mths unemp_4to8mths unemp_8to12mths unemp_1to2yrs) when they are not part of an interaction term
From everything I have read on the internet, I can't work out why the coefficients don't match up. I would be so grateful for any help, I just don't understand what is happening!
This is a sample of my data if this helps.
clear
input long ID float y byte sex float(unemp_lessthan4mths unemp_4to8mths unemp_8to12mths unemp_1to2yrs)
123 10 1 0 0 0 0
123 11 1 0 0 0 0
223 12 1 0 0 0 0
223 12 1 0 0 0 0
223 12 1 0 0 0 0
323 12 0 0 0 0 0
323 6 0 0 0 0 0
323 9 0 0 0 0 0
423 12 0 0 0 0 0
423 12 0 0 0 0 0
423 12 0 0 0 0 0
523 12 1 0 0 0 0
523 12 1 0 0 0 0
523 12 1 0 0 0 0
523 12 1 0 0 0 0
523 12 1 0 0 0 0
523 12 1 0 0 0 0
623 12 1 0 0 0 0
623 2 1 0 0 0 0
623 12 1 0 0 0 0
623 10 1 0 0 0 0
623 11 1 0 0 0 0
723 5 0 0 0 0 0
723 10 0 0 0 0 0
723 0 0 0 0 0 0
723 0 0 0 0 0 0
723 12 0 0 0 0 0
723 9 0 0 0 0 0
723 12 0 0 0 0 0
723 11 0 0 0 0 0
723 12 0 0 0 0 0
723 12 0 0 0 0 0
823 12 1 0 0 0 0
823 12 1 0 0 0 0
823 12 1 0 0 0 0
823 12 1 0 0 0 0
923 12 0 0 0 0 0
923 12 0 0 0 0 0
923 9 0 0 0 0 0
923 12 0 0 0 0 0
923 11 0 0 0 0 0
923 10 0 0 0 0 0
923 10 0 0 0 0 0
923 9 0 0 0 0 0
923 11 0 0 0 0 0
923 12 0 0 0 0 0
124 8 1 0 0 0 0
124 6 1 0 0 0 0
124 3 1 0 0 0 0
124 9 1 0 0 0 0
224 12 0 0 0 0 0
224 12 0 0 0 0 0
224 12 0 0 0 0 0
224 11 0 0 0 0 0
224 11 0 0 0 0 0
224 12 0 0 0 0 0
224 11 0 0 0 0 0
224 12 0 0 0 0 0
224 12 0 0 0 0 0
224 11 0 0 0 0 0
224 12 0 0 0 0 0
225 12 1 0 0 0 0
I am having a problem with including interaction terms in my panel data fixed effects model, and I would be grateful for any help:
I am working with panel data where ID identifies a specific individual across waves. I am studying the effect of different unemployment durations on my dependent variable (y). I have numerous dummy variables representing different durations of unemployment (unemp_lessthan4mths unemp_4to8mths unemp_8to12mths unemp_1to2yrs), and also a dummy variable for sex. I want to compare the coefficients on the unemployment durations between male and females.
I can get coefficients for each group by typing:
(a)
Code:
xtreg y unemp_lessthan4mths unemp_4to8mths unemp_8to12mths unemp_1to2yrs if sex=0, fe vce(cluster ID)
Code:
xtreg y unemp_lessthan4mths unemp_4to8mths unemp_8to12mths unemp_1to2yrs if sex=1, fe vce(cluster ID)
So I tried creating a series of interaction terms:
Code:
xtreg y i.sex##(unemp_lessthan4mths unemp_4to8mths unemp_8to12mths unemp_1to2yrs), fe vce(cluster ID)
My understanding is that this should have produced the same coefficients for unemp_lessthan4mths unemp_4to8mths unemp_8to12mths unemp_1to2yrs as when sex=0, and the coefficients of the interaction term should have been the difference between the coefficients when sex=1 and when sex=0.
However, Stata does not seem to do this. Instead the coefficients produced when unemp_lessthan4mths unemp_4to8mths unemp_8to12mths unemp_1to2yrs are not part of an interaction term are not the same as those produced when regressing either group alone(as in (a) above). And the interaction term coefficients are not the difference between the two coefficients in (a)
Also, the following odd things happen:
1) I get the messages note: "1.sex omitted because of collinearity" and "note: sex omitted because of collinearity"
2) Stata puts a ''1.'' in front of all the variables (unemp_lessthan4mths unemp_4to8mths unemp_8to12mths unemp_1to2yrs) when they are not part of an interaction term
From everything I have read on the internet, I can't work out why the coefficients don't match up. I would be so grateful for any help, I just don't understand what is happening!
This is a sample of my data if this helps.
clear
input long ID float y byte sex float(unemp_lessthan4mths unemp_4to8mths unemp_8to12mths unemp_1to2yrs)
123 10 1 0 0 0 0
123 11 1 0 0 0 0
223 12 1 0 0 0 0
223 12 1 0 0 0 0
223 12 1 0 0 0 0
323 12 0 0 0 0 0
323 6 0 0 0 0 0
323 9 0 0 0 0 0
423 12 0 0 0 0 0
423 12 0 0 0 0 0
423 12 0 0 0 0 0
523 12 1 0 0 0 0
523 12 1 0 0 0 0
523 12 1 0 0 0 0
523 12 1 0 0 0 0
523 12 1 0 0 0 0
523 12 1 0 0 0 0
623 12 1 0 0 0 0
623 2 1 0 0 0 0
623 12 1 0 0 0 0
623 10 1 0 0 0 0
623 11 1 0 0 0 0
723 5 0 0 0 0 0
723 10 0 0 0 0 0
723 0 0 0 0 0 0
723 0 0 0 0 0 0
723 12 0 0 0 0 0
723 9 0 0 0 0 0
723 12 0 0 0 0 0
723 11 0 0 0 0 0
723 12 0 0 0 0 0
723 12 0 0 0 0 0
823 12 1 0 0 0 0
823 12 1 0 0 0 0
823 12 1 0 0 0 0
823 12 1 0 0 0 0
923 12 0 0 0 0 0
923 12 0 0 0 0 0
923 9 0 0 0 0 0
923 12 0 0 0 0 0
923 11 0 0 0 0 0
923 10 0 0 0 0 0
923 10 0 0 0 0 0
923 9 0 0 0 0 0
923 11 0 0 0 0 0
923 12 0 0 0 0 0
124 8 1 0 0 0 0
124 6 1 0 0 0 0
124 3 1 0 0 0 0
124 9 1 0 0 0 0
224 12 0 0 0 0 0
224 12 0 0 0 0 0
224 12 0 0 0 0 0
224 11 0 0 0 0 0
224 11 0 0 0 0 0
224 12 0 0 0 0 0
224 11 0 0 0 0 0
224 12 0 0 0 0 0
224 12 0 0 0 0 0
224 11 0 0 0 0 0
224 12 0 0 0 0 0
225 12 1 0 0 0 0
Comment