forked from jadhazell/stata-binscatter2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
check_speed.log
343 lines (321 loc) · 6.45 KB
/
check_speed.log
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
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
name: <unnamed>
log: C:\Users\Mike\Documents\GitHub\stata-binscatter2\check_speed.log
log type: text
opened on: 14 Feb 2019, 01:43:40
r; t=0.00 1:43:40
.
. *-------------------------------------------------------------------------------
. * Setup options
. *-------------------------------------------------------------------------------
.
. local num_sims 6
r; t=0.00 1:43:40
. local num_bins 10
r; t=0.00 1:43:40
.
. local sim_1_size 1000000
r; t=0.00 1:43:40
. local sim_1_reps 100
r; t=0.00 1:43:40
.
. local sim_2_size 10000000
r; t=0.00 1:43:40
. local sim_2_reps 50
r; t=0.00 1:43:40
.
. local sim_3_size 25000000
r; t=0.00 1:43:40
. local sim_3_reps 25
r; t=0.00 1:43:40
.
. local sim_4_size 50000000
r; t=0.00 1:43:40
. local sim_4_reps 20
r; t=0.00 1:43:40
.
. local sim_5_size 100000000
r; t=0.00 1:43:40
. local sim_5_reps 5
r; t=0.00 1:43:40
.
. local sim_6_size 500000000
r; t=0.00 1:43:40
. local sim_6_reps 5
r; t=0.00 1:43:40
.
. *-------------------------------------------------------------------------------
. * Initialization
. *-------------------------------------------------------------------------------
.
. * Cheap fix: define `sizes' and `num_sims'
. local max_reps 0
r; t=0.00 1:43:40
. forval i=1/`num_sims' {
2. local sizes `sizes' `sims_`i'_size'
3. if `sim_`i'_reps' > `max_reps' local max_reps = `sim_`i'_reps'
4. }
r; t=0.00 1:43:40
.
. * Create matrices to store results
. set matsize 10000
r; t=0.00 1:43:40
. mat results_old = J(`max_reps',`num_sims',.)
r; t=0.00 1:43:40
. mat results_new = J(`max_reps',`num_sims',.)
r; t=0.00 1:43:40
.
. *-------------------------------------------------------------------------------
. * Monte Carlo tests
. *-------------------------------------------------------------------------------
.
. * Cheap fix: define `sizes' and `num_sims'
. forval i=1/`num_sims' {
2. local sizes `sizes' `sim_`i'_size'
3. }
r; t=0.00 1:43:40
.
. local col = 0
r; t=0.00 1:43:40
. forval i=1/`num_sims' {
2. local curr_reps = `sim_`i'_reps'
3. local curr_size = `sim_`i'_size'
4. local col = `col' + 1
5. noi di "sim `i' (reps: `curr_reps')"
6.
. * Run Monte Carlo simulations
. qui forval j=1/`curr_reps' {
7. noi di " rep `j' of `curr_reps'"
8.
. * Generate data
. clear
9. set obs `curr_size'
10. gen x = runiform()
11. gen y = 1 + 2*x + 3*x^2 + 4*x^3 + rnormal()*5*x
12.
. * Test binscatter
. timer on 1
13. qui binscatter y x, nq(`num_bins')
14. timer off 1
15.
.
. * Test binscatter2
. timer on 2
16. qui binscatter2 y x, nq(`num_bins')
17. timer off 2
18.
. * Save results
. timer list
19. mat results_old[`j',`col'] = r(t1)
20. mat results_new[`j',`col'] = r(t2)
21. timer clear
22.
. }
23. }
sim 1 (reps: 100)
rep 1 of 100
rep 2 of 100
rep 3 of 100
rep 4 of 100
rep 5 of 100
rep 6 of 100
rep 7 of 100
rep 8 of 100
rep 9 of 100
rep 10 of 100
rep 11 of 100
rep 12 of 100
rep 13 of 100
rep 14 of 100
rep 15 of 100
rep 16 of 100
rep 17 of 100
rep 18 of 100
rep 19 of 100
rep 20 of 100
rep 21 of 100
rep 22 of 100
rep 23 of 100
rep 24 of 100
rep 25 of 100
rep 26 of 100
rep 27 of 100
rep 28 of 100
rep 29 of 100
rep 30 of 100
rep 31 of 100
rep 32 of 100
rep 33 of 100
rep 34 of 100
rep 35 of 100
rep 36 of 100
rep 37 of 100
rep 38 of 100
rep 39 of 100
rep 40 of 100
rep 41 of 100
rep 42 of 100
rep 43 of 100
rep 44 of 100
rep 45 of 100
rep 46 of 100
rep 47 of 100
rep 48 of 100
rep 49 of 100
rep 50 of 100
rep 51 of 100
rep 52 of 100
rep 53 of 100
rep 54 of 100
rep 55 of 100
rep 56 of 100
rep 57 of 100
rep 58 of 100
rep 59 of 100
rep 60 of 100
rep 61 of 100
rep 62 of 100
rep 63 of 100
rep 64 of 100
rep 65 of 100
rep 66 of 100
rep 67 of 100
rep 68 of 100
rep 69 of 100
rep 70 of 100
rep 71 of 100
rep 72 of 100
rep 73 of 100
rep 74 of 100
rep 75 of 100
rep 76 of 100
rep 77 of 100
rep 78 of 100
rep 79 of 100
rep 80 of 100
rep 81 of 100
rep 82 of 100
rep 83 of 100
rep 84 of 100
rep 85 of 100
rep 86 of 100
rep 87 of 100
rep 88 of 100
rep 89 of 100
rep 90 of 100
rep 91 of 100
rep 92 of 100
rep 93 of 100
rep 94 of 100
rep 95 of 100
rep 96 of 100
rep 97 of 100
rep 98 of 100
rep 99 of 100
rep 100 of 100
sim 2 (reps: 50)
rep 1 of 50
rep 2 of 50
rep 3 of 50
rep 4 of 50
rep 5 of 50
rep 6 of 50
rep 7 of 50
rep 8 of 50
rep 9 of 50
rep 10 of 50
rep 11 of 50
rep 12 of 50
rep 13 of 50
rep 14 of 50
rep 15 of 50
rep 16 of 50
rep 17 of 50
rep 18 of 50
rep 19 of 50
rep 20 of 50
rep 21 of 50
rep 22 of 50
rep 23 of 50
rep 24 of 50
rep 25 of 50
rep 26 of 50
rep 27 of 50
rep 28 of 50
rep 29 of 50
rep 30 of 50
rep 31 of 50
rep 32 of 50
rep 33 of 50
rep 34 of 50
rep 35 of 50
rep 36 of 50
rep 37 of 50
rep 38 of 50
rep 39 of 50
rep 40 of 50
rep 41 of 50
rep 42 of 50
rep 43 of 50
rep 44 of 50
rep 45 of 50
rep 46 of 50
rep 47 of 50
rep 48 of 50
rep 49 of 50
rep 50 of 50
sim 3 (reps: 25)
rep 1 of 25
rep 2 of 25
rep 3 of 25
rep 4 of 25
rep 5 of 25
rep 6 of 25
rep 7 of 25
rep 8 of 25
rep 9 of 25
rep 10 of 25
rep 11 of 25
rep 12 of 25
rep 13 of 25
rep 14 of 25
rep 15 of 25
rep 16 of 25
rep 17 of 25
rep 18 of 25
rep 19 of 25
rep 20 of 25
rep 21 of 25
rep 22 of 25
rep 23 of 25
rep 24 of 25
rep 25 of 25
sim 4 (reps: 20)
rep 1 of 20
rep 2 of 20
rep 3 of 20
rep 4 of 20
rep 5 of 20
rep 6 of 20
rep 7 of 20
rep 8 of 20
rep 9 of 20
rep 10 of 20
rep 11 of 20
rep 12 of 20
rep 13 of 20
rep 14 of 20
rep 15 of 20
rep 16 of 20
rep 17 of 20
rep 18 of 20
rep 19 of 20
rep 20 of 20
sim 5 (reps: 5)
rep 1 of 5
rep 2 of 5
rep 3 of 5
rep 4 of 5
rep 5 of 5
sim 6 (reps: 5)
rep 1 of 5