Hello to all,
I am not very strong in STATA but I wrote a program. I wanted to parallelize a loop. But, while searching, I didn't find a commercial way to parallelize it directly. So I integrated the loop in a program that I parallelized afterward.
The objective is to make regression under several sub-samples chosen with the variable "rp_partner_rank".
Then I have to get information about my variable of interest: lag_fdi_in_all
and the stocks in the variables.
But the code doesn't work, I have tested several ways with even the "parallele do" command, saving the loop in a do file. but the results are not what I expect. Please can you help me?
here are the error results
How should I parallelize this loop?
I am not very strong in STATA but I wrote a program. I wanted to parallelize a loop. But, while searching, I didn't find a commercial way to parallelize it directly. So I integrated the loop in a program that I parallelized afterward.
The objective is to make regression under several sub-samples chosen with the variable "rp_partner_rank".
Then I have to get information about my variable of interest: lag_fdi_in_all
and the stocks in the variables.
Code:
program define savereg qui { sum rp_partner_rank forvalues i = `r(min)' (1) `r(max)' { xi: reg rp_avg_pc_epi_gap_abs lag_fdi_in_all $contrlsorder i.year i.pccountry i.rpcountry if rp_partner_rank <= `i', vce(cl id) lincom _b[lag_fdi_in_all], l(95) replace beta = r(estimate) in `i' replace se = r(se) in `i' replace i_pos = `i' in `i' replace lb_95 = r(lb) in `i' replace ub_95 = r(ub) in `i' lincom _b[lag_fdi_in_all], l(90) replace lb_90 = r(lb) in `i' replace ub_90 = r(ub) in `i' lincom _b[lag_fdi_in_all], l(99) replace lb_99 = r(lb) in `i' replace ub_99 = r(ub) in `i' } } end preserve drop beta se i_pos lb_* ub_* g i_pos = . g beta = . g se = . g lb_90 = . g lb_95 = . g lb_99 = . g ub_90 = . g ub_95 = . g ub_99 = . parallel prog(savereg): savereg *parallel: savereg *parallel do "$Code\saveregdo.do" *drop if beta==. keep beta se i_pos lb_* ub_* parallel append, do(savereg) prog(savereg) e(3) twoway rarea ub_90 lb_90 i_pos , astyle(ci) || /// line beta i_pos save "$DataCreated\asup", replace restore
But the code doesn't work, I have tested several ways with even the "parallele do" command, saving the loop in a do file. but the results are not what I expect. Please can you help me?
here are the error results
Code:
. parallel prog(savereg): savereg -------------------------------------------------------------------------------- Parallel Computing with Stata (by GVY) Clusters : 4 pll_id : l9d9vacs17 Running at : G:\Etude et biblio\Université\tours\Master2 IE\Econometrie avancee\memoire\donn > ees\Code Randtype : datetime Waiting for the clusters to finish... cluster 0002 Exited with error -199- while running the command/dofile (view log)... cluster 0003 Exited with error -199- while running the command/dofile (view log)... cluster 0004 Exited with error -199- while running the command/dofile (view log)... cluster 0001 Exited with error -199- while running the command/dofile (view log)... -------------------------------------------------------------------------------- Enter -parallel printlog #- to checkout logfiles. -------------------------------------------------------------------------------- .