Dear listers,
for 200 firms I observe how their pricing responds to changes in costs in 5 periods each.
Now I would like to obtain firm-specific estimates of cost-price-responses and plot their distribution.
Since running a separate estimation for each firm would in expectation take rather long, I've started with this:
Now I would like to generate a variable that contains for each firm the main effect of cost plus the relevant interaction, a bit like this:
One problem is that I do not know what exactly to put in between the second _b[...].
The other is that coefficients on some of the firms get dropped due to collinearity, so I would need to make this loop run over all values including those for which no interaction was estimated, and just fill in a zero interactions for missing interactions.
Can someone see either how I can get this code to do what I want,
or see another, smarter way of doing it?
Thanks so much!
PM
for 200 firms I observe how their pricing responds to changes in costs in 5 periods each.
Now I would like to obtain firm-specific estimates of cost-price-responses and plot their distribution.
Since running a separate estimation for each firm would in expectation take rather long, I've started with this:
Code:
reghdfe price c.cost##firmid, absorb(year)
Code:
gen firmresponse=. forval n=1/200 { replace firmresponse = _b[cost] + _b[cost##firmid_`n'] if firmid==`n' }
The other is that coefficients on some of the firms get dropped due to collinearity, so I would need to make this loop run over all values including those for which no interaction was estimated, and just fill in a zero interactions for missing interactions.
Can someone see either how I can get this code to do what I want,
or see another, smarter way of doing it?
Thanks so much!
PM
Comment