Hello everybody,
let me get this out first: I am sure the seasoned Stata experts under you will laugh at me; rightfully so, my question is trivial.
I am new to Stata and currently writing my master thesis.
For this reason I want to take an exisiting dataset (dta data.dta and their do file do file.do are in the attachements), split the Oil Price Shock-variable, which is petro_nx_index_growth in positive shocks and negative shocks and run the same regressions afterwards.
Unclear is for me, if or where in the split variables the 0s need to be (I tried both and failed twice) or how I split the variable in general...
I am experimenting with the code for that, currently I have:
set memory 100m
tab ccode, gen(Iccode)
tab year, gen(time)
xtset ccode year, yearly
* Try to split the Oil Price Shocks into positive an negative shocks
gen pos_petro_nx_index_growth = petro_nx_index_growth if petro_nx_index_growth >= 0
gen neg_petro_nx_index_growth = petro_nx_index_growth if petro_nx_index_growth <= 0
gen a_pos_petro_nx_index_growth = petro_nx_index_growth if petro_nx_index_growth > 0
gen a_neg_petro_nx_index_growth = petro_nx_index_growth if petro_nx_index_growth < 0
*Table 2 with split shocks
*With 0s in both
eststo clear
eststo mod1: quietly xtreg D.polity2 L(0/2).pos_petro_nx_index_growth L(0/2).neg_petro_nx_index_growth time* if D.exconst2!=. &growth!=., fe cluster(ccode)
eststo mod2: quietly xtreg D.exconst2 L(0/2).pos_petro_nx_index_growth L(0/2).neg_petro_nx_index_growth time* if growth!=. ,fe cluster(ccode)
eststo mod3: quietly xtreg D.exrec2 L(0/2).pos_petro_nx_index_growth L(0/2).neg_petro_nx_index_growth time* if growth!=. , fe cluster(ccode)
eststo mod4: quietly xtreg D.polcomp2 L(0/2).pos_petro_nx_index_growth L(0/2).neg_petro_nx_index_growth time* if growth!=., fe cluster(ccode)
esttab mod? using test1.txt, replace nonotes nogap drop(time* _cons) star( * 0.1 ** 0.05 *** 0.01 )
*Without 0s
eststo clear
eststo mod1: quietly xtreg D.polity2 L(0/2).a_pos_petro_nx_index_growth L(0/2)a_neg_petro_nx_index_growth time* if D.exconst2!=. &growth!=., fe cluster(ccode)
eststo mod2: quietly xtreg D.exconst2 L(0/2).a_pos_petro_nx_index_growth L(0/2).a_neg_petro_nx_index_growth time* if growth!=. ,fe cluster(ccode)
eststo mod3: quietly xtreg D.exrec2 L(0/2).a_pos_petro_nx_index_growth L(0/2).a_neg_petro_nx_index_growth time* if growth!=. , fe cluster(ccode)
eststo mod4: quietly xtreg D.polcomp2 L(0/2).a_pos_petro_nx_index_growth L(0/2).a_neg_petro_nx_index_growth time* if growth!=., fe cluster(ccode)
esttab mod? using test2.txt, replace nonotes nogap drop(time* _cons) star( * 0.1 ** 0.05 *** 0.01 )
I have to stay, that I am gratefull for any help on this regard.
Greetings and have a great day,
Leon
let me get this out first: I am sure the seasoned Stata experts under you will laugh at me; rightfully so, my question is trivial.
I am new to Stata and currently writing my master thesis.
For this reason I want to take an exisiting dataset (dta data.dta and their do file do file.do are in the attachements), split the Oil Price Shock-variable, which is petro_nx_index_growth in positive shocks and negative shocks and run the same regressions afterwards.
Unclear is for me, if or where in the split variables the 0s need to be (I tried both and failed twice) or how I split the variable in general...
I am experimenting with the code for that, currently I have:
set memory 100m
tab ccode, gen(Iccode)
tab year, gen(time)
xtset ccode year, yearly
* Try to split the Oil Price Shocks into positive an negative shocks
gen pos_petro_nx_index_growth = petro_nx_index_growth if petro_nx_index_growth >= 0
gen neg_petro_nx_index_growth = petro_nx_index_growth if petro_nx_index_growth <= 0
gen a_pos_petro_nx_index_growth = petro_nx_index_growth if petro_nx_index_growth > 0
gen a_neg_petro_nx_index_growth = petro_nx_index_growth if petro_nx_index_growth < 0
*Table 2 with split shocks
*With 0s in both
eststo clear
eststo mod1: quietly xtreg D.polity2 L(0/2).pos_petro_nx_index_growth L(0/2).neg_petro_nx_index_growth time* if D.exconst2!=. &growth!=., fe cluster(ccode)
eststo mod2: quietly xtreg D.exconst2 L(0/2).pos_petro_nx_index_growth L(0/2).neg_petro_nx_index_growth time* if growth!=. ,fe cluster(ccode)
eststo mod3: quietly xtreg D.exrec2 L(0/2).pos_petro_nx_index_growth L(0/2).neg_petro_nx_index_growth time* if growth!=. , fe cluster(ccode)
eststo mod4: quietly xtreg D.polcomp2 L(0/2).pos_petro_nx_index_growth L(0/2).neg_petro_nx_index_growth time* if growth!=., fe cluster(ccode)
esttab mod? using test1.txt, replace nonotes nogap drop(time* _cons) star( * 0.1 ** 0.05 *** 0.01 )
*Without 0s
eststo clear
eststo mod1: quietly xtreg D.polity2 L(0/2).a_pos_petro_nx_index_growth L(0/2)a_neg_petro_nx_index_growth time* if D.exconst2!=. &growth!=., fe cluster(ccode)
eststo mod2: quietly xtreg D.exconst2 L(0/2).a_pos_petro_nx_index_growth L(0/2).a_neg_petro_nx_index_growth time* if growth!=. ,fe cluster(ccode)
eststo mod3: quietly xtreg D.exrec2 L(0/2).a_pos_petro_nx_index_growth L(0/2).a_neg_petro_nx_index_growth time* if growth!=. , fe cluster(ccode)
eststo mod4: quietly xtreg D.polcomp2 L(0/2).a_pos_petro_nx_index_growth L(0/2).a_neg_petro_nx_index_growth time* if growth!=., fe cluster(ccode)
esttab mod? using test2.txt, replace nonotes nogap drop(time* _cons) star( * 0.1 ** 0.05 *** 0.01 )
I have to stay, that I am gratefull for any help on this regard.
Greetings and have a great day,
Leon
Comment