Hi guys!
I have the following problem. I would like to replicate the following xtreg , fe:
with demeaned OLS. So first of all I have demeaned the variables like that:
The DB looks like this (just reported one category):
At this point however I have some doubts:
I have the following problem. I would like to replicate the following xtreg , fe:
Code:
xtreg tasso_crescita_salespr L.log_sales L.dummy_2 L2.dummy_2 L3.dummy_2 mean_gr_rate_atc2 recalls_sales ageprodcat1 ageprodcat2 ageprodcat3 ageprodcat4 newmolfirm newmolmarket i.Year, fe vce(cluster idpr)
Code:
bysort idpr (Year) : center tasso_crescita_sales_prod, gen (tasso_crescita_salespr_demeaned) // equivalente a fare: egen tasso_crescita_salespr_demeaned = mean(tasso_crescita_s), by(idpr) bysort idpr (Year) : center log_sales, gen (log_sales_demeaned) bysort idpr (Year) : center mean_gr_rate_atc2, gen (mean_gr_rate_atc2_demeaned) bysort idpr (Year) : center dummy_2, gen (dummy_2_demeaned) bysort idpr (Year) : center newmolfirm, gen (newmolfirm_demeaned) bysort idpr (Year) : center newmolmarket, gen (newmolmarket_demeaned) bysort idpr (Year) : center recalls_sales, gen (recalls_sales_demeaned) *N.B. ageprodcat1 ageprodcat2 ageprodcat3 ageprodcat4 sono già dummizzate (non sono categoriche) quindi posso già farci il demeaning: bysort idpr (Year) : center ageprodcat1, gen (ageprodcat1_demeaned) bysort idpr (Year) : center ageprodcat2, gen (ageprodcat2_demeaned) bysort idpr (Year) : center ageprodcat3, gen (ageprodcat3_demeaned) bysort idpr (Year) : center ageprodcat4, gen (ageprodcat4_demeaned)
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input float dummy_2 byte ageprodcat1 float(newmolmarket newmolfirm newmolfirm_demeaned newmolmarket_demeaned tasso_crescita_sales_prod) 0 1 1 . . .5 . 1 1 0 1 0 -.5 . 0 0 1 . . .875 . 0 0 0 0 0 -.125 3.1807585 0 0 0 0 0 -.125 . 0 0 0 0 0 -.125 12.165902 0 0 0 0 0 -.125 . 1 0 0 0 0 -.125 . 0 0 0 0 0 -.125 . 0 0 0 0 0 -.125 . 1 1 1 . . .9166667 . 1 1 0 0 0 -.08333334 18.725441 0 1 0 0 0 -.08333334 18.340553 0 0 0 0 0 -.08333334 18.435717 0 0 0 0 0 -.08333334 18.86105 0 0 0 0 0 -.08333334 19.39682 0 0 0 0 0 -.08333334 18.886513 0 0 0 0 0 -.08333334 18.683449 0 0 0 0 0 -.08333334 18.159758 1 0 0 0 0 -.08333334 19.067064 0 0 0 0 0 -.08333334 19.46246 0 0 0 0 0 -.08333334 . 0 1 0 1 .9090909 0 . 0 1 0 0 -.0909091 0 16.825748 0 1 0 0 -.0909091 0 17.012917 0 1 0 0 -.0909091 0 14.926245 1 1 0 0 -.0909091 0 15.29373 0 0 0 0 -.0909091 0 15.47137 0 0 0 0 -.0909091 0 . 0 0 0 0 -.0909091 0 13.862047 0 0 0 0 -.0909091 0 17.476244 0 0 0 0 -.0909091 0 17.279263 0 0 0 0 -.0909091 0 15.7814 0 0 1 . . .9166667 . 0 0 0 0 0 -.08333334 . 0 0 0 0 0 -.08333334 . 0 0 0 0 0 -.08333334 . 0 0 0 0 0 -.08333334 . 1 0 0 0 0 -.08333334 . 0 0 0 0 0 -.08333334 . 0 0 0 0 0 -.08333334 . 0 0 0 0 0 -.08333334 . 0 0 0 0 0 -.08333334 . 0 0 0 0 0 -.08333334 . 0 0 0 0 0 -.08333334 11.292548 0 0 1 . . .8571429 . 0 0 0 0 0 -.14285715 . 0 0 0 0 0 -.14285715 . 0 0 0 0 0 -.14285715 . 0 0 0 0 0 -.14285715 . 1 0 0 0 0 -.14285715 . 0 0 0 0 0 -.14285715 . 0 0 1 . . .9166667 . 0 0 0 0 0 -.08333334 . 0 0 0 0 0 -.08333334 . 0 0 0 0 0 -.08333334 . 0 0 0 0 0 -.08333334 . 0 0 0 0 0 -.08333334 14.164447 0 1 0 0 0 -.08333334 . 1 1 0 0 0 -.08333334 . 0 1 0 0 0 -.08333334 . 0 1 0 0 0 -.08333334 . 0 0 0 0 0 -.08333334 . 0 0 0 0 0 -.08333334 10.16614 0 0 1 . . .9166667 . 0 0 0 0 0 -.08333334 . 0 0 0 0 0 -.08333334 13.10945 0 0 0 0 0 -.08333334 . 0 0 0 0 0 -.08333334 . 1 0 0 0 0 -.08333334 . 1 0 0 0 0 -.08333334 . 0 0 0 0 0 -.08333334 . 0 0 0 0 0 -.08333334 . 0 0 0 0 0 -.08333334 . 0 0 0 0 0 -.08333334 . 0 0 0 0 0 -.08333334 . 0 1 1 . . .9166667 . 0 1 0 0 0 -.08333334 13.415682 0 1 0 0 0 -.08333334 13.316372 0 1 0 0 0 -.08333334 13.7403 0 1 0 0 0 -.08333334 14.663067 0 0 0 0 0 -.08333334 14.747814 1 0 0 0 0 -.08333334 14.361357 1 0 0 0 0 -.08333334 14.021648 0 0 0 0 0 -.08333334 . 0 0 0 0 0 -.08333334 . 0 0 0 0 0 -.08333334 . 0 0 0 0 0 -.08333334 . 0 1 1 . . .9166667 . 0 1 0 0 0 -.08333334 . 0 1 0 0 0 -.08333334 9.691856 0 1 0 0 0 -.08333334 12.495008 0 1 0 0 0 -.08333334 10.372454 0 0 0 0 0 -.08333334 12.004423 0 0 0 0 0 -.08333334 . 0 0 0 0 0 -.08333334 10.91284 0 0 0 0 0 -.08333334 11.242186 0 0 0 0 0 -.08333334 . 0 0 0 0 0 -.08333334 . 1 0 0 0 0 -.08333334 . end
At this point however I have some doubts:
- my original fixed effect model contains lags. How should I treat them in the demeaned case?
- the dummies (dummy_2, newmolfirm, newmolmarket, ageprodcat*) represent: dummy_2 = recall of product I at time t; newmolfirm = 1 the first year that the product isappears in the firm's portfolio, newmolmarket = 1 if the molecule related to the product appeared for the very first time in the sample; ageprodcat = age of the product. Since they vary in time I have to demean them also right?
- Finally recalls_sales is an interaction between sales (continuous variable) and recalls (dummy). Do I have to demean also this?
- Are fixed effects automatically thrown away?