-
Notifications
You must be signed in to change notification settings - Fork 0
/
Lancer_EstimTC.do
271 lines (180 loc) · 5.86 KB
/
Lancer_EstimTC.do
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
*************************************************
* Programme : Lancer les estimations
* Estimer les additive & iceberg trade costs
* Using Hummels trade data (version soumission)
*
* Mars 2020
*
*************************************************
*version 12
if "`c(username)'" =="guillaumedaudin" {
global dir "~/Documents/Recherche/2013 -- Trade Costs -- local"
global dir_pgms "~/Répertoires GIT/trade_costs_git"
global dir_log "$dir/Logs divers"
global dir_temp "~/Downloads/temp_stata"
}
** Fixe Lise bureau, en local sur MyWork
if "`c(hostname)'" =="LAB0271A" {
global dir "\\storage2016.windows.dauphine.fr\home\l\lpatureau\My_Work\Lise\trade_costs"
global dir_pgms "\\storage2016.windows.dauphine.fr\home\l\lpatureau\My_Work\Git\trade_costs"
global dir_log "C:\Users\lpatureau\Dropbox\trade_cost\Log divers"
}
/* Vieux portable Lise
if "`c(hostname)'" =="lise-HP" {
global dir C:\Users\lise\Dropbox\trade_cost
}
*/
/* Nouveau portable Lise */
if "`c(hostname)'" =="MSOP112C" {
* En local sur le disque dur
global dir_pgms C:\Users\Ipatureau\Documents\trade_costs
global dir_log "C:\Users\lpatureau\Dropbox\trade_cost\Logs divers"
}
if "`c(hostname)'" =="hericourt" {
global dir D:\Hericourt\trade_costs
global dir_data D:\Hericourt\trade_costs\data
global dir_pgms D:\Hericourt\trade_costs\pgms
global dir_log D:\Hericourt\trade_costs\Logs divers
}
/* Nouveau fixe Bureau Lise: Tout en local sur MyWork. Pour la base et les résultats, dossier Lise ; pgms dans le dossier Git (de MyWork) */
if "`c(hostname)'" =="LAB0661F" {
global dir "//storage2016.windows.dauphine.fr/home/l/lpatureau/My_Work/Lise/trade_costs"
global dir_data "$dir/data"
global dir_pgms "//storage2016.windows.dauphine.fr/home/l/lpatureau/My_Work/Git/trade_costs"
global dir_log "$dir/Log_divers"
global dir_temp "$dir/temp_stata"
}
*******************************************************
set more off
do "$dir_pgms/Estim_value_TC.do"
*do D:\Hericourt\trade_costs\pgms\Estim_value_TC.do
***** LANCER LES ESTIMATIONS **************************
*******************************************************
*local year 1974
*** À adapter suivant les besoins
*******************************************************
capture program drop EstimTC
program EstimTC
args year mode level_product level_sector bdd model
capture log close
global test
****Si test
*global test test2
******
* sauver le log file chez Guillaume
if "`c(username)'" =="guillaumedaudin" {
log using "$dir_log/${test}log_prep_reg_base_`year'_`mode'_`level_product'_`level_sector'_`bdd'.smcl", replace
}
* sauver le log file chez Lise
if "`c(hostname)'" =="LAB0271A" | "`c(hostname)'" =="MSOP112C" | "`c(hostname)'" =="LAB0661F" {
log using "$dir_log/${test}log_prep_reg_base_`year'_`mode'_`level_product'_`level_sector'_`bdd'.smcl", replace
}
* sauver le log file chez Jerome
if "`c(hostname)'" =="hericourt" {
log using "$dir_log/${test}log_prep_reg_base_`year'_`mode'_`level_product'_`level_sector'_`bdd'.smcl", replace
}
prep_reg `bdd' `year' `level_product' `level_sector' `mode' `model'
* 2013 air ne converge pas
log close
translate "$dir_log/${test}log_prep_reg_base_`year'_`mode'_`level_product'_`level_sector'_`bdd'.smcl" /*
*/"$dir_log/${test}log_prep_reg_base_`year'_`mode'_`level_product'_`level_sector'_`bdd'.pdf", replace
erase "$dir_log/${test}log_prep_reg_base_`year'_`mode'_`level_product'_`level_sector'_`bdd'.smcl"
end
/*
*Pour quand on a les quantités Hummels
local mode air
*foreach year of numlist 1976(3)2019
foreach y of numlist 2014(-1) 1974 {
foreach m in `mode' {
EstimTC `y' `m' 5 3 hummels_tra_qy1_wgt
EstimTC `y' `m' 5 3 hummels_tra_qy1_qy
}
}
*/
/*
*Pour quand on a les quantités HS10
local mode air /*ves*/
*foreach year of numlist 1976(3)2019
*/
local mode air
foreach y of numlist 2019 /*(-1)2002*/ {
foreach m in `mode' {
EstimTC `y' `m' 5 3 hs10_qy1_qy
EstimTC `y' `m' 5 3 hs10_qy1_wgt
}
}
*/
***Pour IV 5/3
/*local mode ves
foreach y of numlist 2012 {
foreach m in `mode' {
EstimTC `y' `m' 5 3 FS_predictions_both_yearly_prod5_sect3
}
}
*/
/*
***Pour IV 10/3
local mode air ves
*foreach y of numlist 2003(1)2019 {
foreach y of numlist 2016(1)2019 {
foreach m in `mode' {
EstimTC `y' `m' 10 3 FS_predictions_both_yearly_prod10_sect3
}
}
*/
****Pour baseline
/*
local mode /*ves*/ air
foreach y of numlist 2017 2019 {
foreach m in `mode' {
EstimTC `y' `m' 5 3 hummels_tra nlAetI
}
}
*/
/*
*****Pour HS10 10/3
*local year 1997 1998 1999 2002(1) 2019
local mode ves
foreach y of numlist 2014(-1)2010 {
foreach m in `mode' {
EstimTC `y' `m' 10 3 base_hs10_newyears
}
}
*/
/*
********4 digits
**Cela ne marche pas lorsque les produits sont à 10-digits : c’est trop long
**7 jours pour 18 itérations sur 2005 par exemple
set more off
local mode air ves /*ves*/
local year /*1974 1977 1981 1985 1989 1993 1997 2001*/ 2005 2009 2013
* attention pb en 1989 air il faut passer à 300 itérations pour 5/3
foreach m in `mode' {
foreach y in `year' {
capture log close
log using log_prep_reg_base_hs10_newyears_`y'_10_4_`m', replace
*prep_reg `y' sitc2 4 `m'
prep_reg base_hs10_newyears `y' 10 4 `m'
*erase "$dir/results/blouk_nlA_`year'_`class'_`preci'_`mode'.dta"
*erase "$dir/results/blouk_nlI_`year'_`class'_`preci'_`mode'.dta"
log close
}
}
*/
/*
****Pour baseline nlA
local mode air ves
foreach y of numlist 1974/2019 {
foreach m in `mode' {
EstimTC `y' `m' 5 3 hummels_tra nlA
}
}
*/
/*
****Pour baseline nlI
local mode air ves
foreach y of numlist 1974 1977(4)2017 2019 {
foreach m in `mode' {
EstimTC `y' `m' 5 3 hummels_tra nlI
}
}