I have a simple program that estimates that regresses an outcome on (a) event-time dummies (i.e. dummies for time relative to year in which a particular event happens), (b) age dummies and (c) year dummies. I then estimate margins at the unique values of the event-time variable (e.g., 1 period before event, 2 periods before event,...) that abstract from the effect of the event (i.e., I set the event-dummies to zero; put differently, I consider the effect at the value of the constant). Here is the program:
Code:
cap program drop event_study
program define event_study, rclass
*** Syntax
syntax [varlist] [if], [ ///
outcome(string) ///
time(string) ///
baselevel(string) ///
age_F(string) ///
years(string)]
*** Regression
reg `outcome' ///
ib`baselevel'.`time' ///
i.`age_F' ///
i.`years', r
*** Margins
margins, over(`time') at(`time' = `baselevel') nose
end
Thank you so much for your help!
0 Response to Alternatives to margins command (too slow)
Post a Comment