Hello dear stata community.
Im using the replication data file of Moritz Schularick, When credit bites back (2013).
The author use a local projection approach.
The loop is working but the sum of ssr0 after the loop isn't. The error is... variable ssr0 not found. I don't understand why...
there's the code and thanks for the help.
foreach v of local justgdp {
gen ssr0`v'=.
gen ssr1`v'=.
gen nobs`v'=.
forvalues i =1/5 {
forvalues j= 1/1 {
qui reg `v'`i' pk_norm pk_fin srx_norm_prv srx_fin_prv `rhs7' dum1-dum13 ///
if core==1 & (year<1928|year>1946), noconstant //alt
qui reg `v'`i' pk_norm pk_fin `rhs7' dum1-dum13 ///
if e(sample)==1, noconstant // null, same sample
replace ssr0`v'=e(rss) if _n==`i'
reg `v'`i' pk_norm pk_fin srx_norm_prv srx_fin_prv `rhs7' dum1-dum13 ///
if core==1 & (year<1928|year>1946), noconstant
eststo h`i'
replace ssr1`v'=e(rss) if _n==`i'
replace nobs`v'=e(N) if _n==`i'
test pk_fin=pk_norm // amt test
estadd scalar p_diff1 = r(p)
test srx_norm_prv=srx_fin_prv // amt test
estadd scalar p_diffsrx = r(p)
sum pk_norm if e(sample)
estadd scalar Norm = r(sum)
sum pk_fin if e(sample)
estadd scalar Fin = r(sum)
}
}
}
sum ssr0
Im using the replication data file of Moritz Schularick, When credit bites back (2013).
The author use a local projection approach.
The loop is working but the sum of ssr0 after the loop isn't. The error is... variable ssr0 not found. I don't understand why...
there's the code and thanks for the help.
foreach v of local justgdp {
gen ssr0`v'=.
gen ssr1`v'=.
gen nobs`v'=.
forvalues i =1/5 {
forvalues j= 1/1 {
qui reg `v'`i' pk_norm pk_fin srx_norm_prv srx_fin_prv `rhs7' dum1-dum13 ///
if core==1 & (year<1928|year>1946), noconstant //alt
qui reg `v'`i' pk_norm pk_fin `rhs7' dum1-dum13 ///
if e(sample)==1, noconstant // null, same sample
replace ssr0`v'=e(rss) if _n==`i'
reg `v'`i' pk_norm pk_fin srx_norm_prv srx_fin_prv `rhs7' dum1-dum13 ///
if core==1 & (year<1928|year>1946), noconstant
eststo h`i'
replace ssr1`v'=e(rss) if _n==`i'
replace nobs`v'=e(N) if _n==`i'
test pk_fin=pk_norm // amt test
estadd scalar p_diff1 = r(p)
test srx_norm_prv=srx_fin_prv // amt test
estadd scalar p_diffsrx = r(p)
sum pk_norm if e(sample)
estadd scalar Norm = r(sum)
sum pk_fin if e(sample)
estadd scalar Fin = r(sum)
}
}
}
sum ssr0

Comment