I work with trade data: 75 importers, 75 exporters; 2004-2018 period, six-digit HS Industries (5219).
Hence, I have about half a billion row observations (440 353 125).
I have variables: I (exporter); j(importer); k(six-digit industry); 4d (four-digit industry); v(trade in value); q(trade in quantity); one explanatory variable (expl); one control variable (contr).
explanatory variable varies across six-digit industries and time; expl
control variable varies across importer, six-digit industry and time; contrl
My core regression is (I deal with highly disaggregated data with many zeros):
ppmlhdfe v expl contr, absorb(i_j_4d_t)
where: egen i_j_4d_t=group(I j 4d t)
However, I understand that both explanatory and control variables are endogenous (especially control).
I found suitable instruments for both variables.
Instrument for explanatory variable varies across six-digit industry only. – Instr1
Instrument for control variable varies across importer and six-digit industry. – Instr2
My question is how it is better to proceed with instrumental variable approach in Stata?
ppmlhdfe does not consider instruments` approach, right?
I thought about the following approach:
Step 1 – this step is done in a separate stata file with expl and instr1 variables and 4d and t variables.
reghdfe expl instr1, absorb (4d_t)
where: egen 4d_t=group(4d_t)
predict expl_instr, xb
Step 2 – this step is done in a separate stata file with contr and instr2 variables and 4d, t and j variables.
reghdfe contr instr2, absorb (j_4d_t)
where: egen j_4d_t=group(j_4d_t)
predict contr_instr, xb
Step 3 – I merge expl_instr and contr_instr into main stata file and estimate:
ppmlhdfe v expl_instr contr_instr, absorb(i_j_4d_t)
Does this approach seem at least somehow appropriate? Can there be better alternatives? I am now working to apply this approach.
The related problem is that I work with quite large datasets and it is not clear if I will be able to merge expl_instr and contr_instr with the main file as my stata already three days runs the command: egen kt=group(k t) needed to merge instrumented explanatory variable, for example (Not responding status for one day).
Yes, I could merge instruments directly into the main file, but this would remain the problem of slow running when merging and could complicate further estimations from technical point of view.
I am very sorry for the long description and will be very grateful for any advice!
Related Posts with trade structural gravity equation; instruments; ppmlhdfe
error: rename using local inside loopDear Stata-users, I have a problem with rename using local inside loop. I would like to import an …
Merging, tsfill, expand or collapse(max)?Hello, Please, I am trying to merge two datasets. Could anyone help me? I have the following variab…
How to estimate mortality and CIs from survival data (KM curves)?Hi everyone, I'm doing survival analysis in Stata 17. I'd like to estimate the rate of mortality an…
Simulate Autoregressive ProcessI wanna simulate an AR process like this (see section 2). I've tried this Code: clear set obs 2…
Perform additional condition after other conditions are metDear Statalist, I am trying to generate a new variable NewCost based on another variable Cost. I wa…
Subscribe to:
Post Comments (Atom)
0 Response to trade structural gravity equation; instruments; ppmlhdfe
Post a Comment