I aim to incorporate the p-value from the unit root test (uroot) as an additional coefficient estimate in my regression results. Currently, I automate its inclusion as an extra statistic in the lower section of the table. Is there a method to achieve this through esttab without the need for matrix manipulation for increased flexibility?
For context llctest is just a program that is done manually to the unit root test.
<code>
//Table
local j = 1
foreach var in A B C D E F G H {
rename `var' Autocracy
qui xtreg ln_gdp Autocracy l(1/4).ln_gdp i.year, fe cluster(code)
llctest ln_gdp (Autocracy) (), lags(3)
mat uroot = r(pvalmain)
xtreg ln_gdp Autocracy l(1/4).ln_gdp i.year, fe cluster(code)
eststo r`j'
qui estadd local FE "Yes", replace
qui estadd local lags "Yes", replace
estadd local uroot "`:di %6.3f uroot[1,1]'", replace
rename Autocracy `var'
local j = `j' + 1
}
esttab r1 r2 r3 r4 r5 r6 r7 r8 using "table.tex", ///
prehead(" defsym#1{ifmmode^{#1}else(^{#1})fi} \ \ begin{tabular}{l*{8}{c}} hlinehline") ///
mtitles("A" "B" "C" "D" "E" "F" "G" "H" ) ///
mgroups("Outcome: Log GDP per capita", pattern(1 0 0 0 0 0 0 0 ) ///
prefix(multicolumn{@span}{c}{) suffix(}) span erepeat(cmidrule(lr){@span})) alignment(D{.}{.}{-1}) ///
label ///
booktabs ///
b(%8.3f) se (%8.3f) ///
star(* .10 ** .05 *** .01) ///
keep(Autocracy) ///
stats(FE lags N N_g uroot, fmt(%12.0g %12.0g %12.0g %12.0g %6.0f) labels ("Country & year FE " "Four GDP lags" "Observations" "Countries" "p-value, unit root test")) ///
prefoot("hline") ///
postfoot("hlinehline \ end{tabular} ") ///
replace
</code>
<code>
//Table
local j = 1
foreach var in A B C D E F G H {
rename `var' Autocracy
qui xtreg ln_gdp Autocracy l(1/4).ln_gdp i.year, fe cluster(code)
llctest ln_gdp (Autocracy) (), lags(3)
mat uroot = r(pvalmain)
xtreg ln_gdp Autocracy l(1/4).ln_gdp i.year, fe cluster(code)
eststo r`j'
qui estadd local FE "Yes", replace
qui estadd local lags "Yes", replace
estadd local uroot "`:di %6.3f uroot[1,1]'", replace
rename Autocracy `var'
local j = `j' + 1
}
esttab r1 r2 r3 r4 r5 r6 r7 r8 using "table.tex", ///
prehead(" defsym#1{ifmmode^{#1}else(^{#1})fi} \ \ begin{tabular}{l*{8}{c}} hlinehline") ///
mtitles("A" "B" "C" "D" "E" "F" "G" "H" ) ///
mgroups("Outcome: Log GDP per capita", pattern(1 0 0 0 0 0 0 0 ) ///
prefix(multicolumn{@span}{c}{) suffix(}) span erepeat(cmidrule(lr){@span})) alignment(D{.}{.}{-1}) ///
label ///
booktabs ///
b(%8.3f) se (%8.3f) ///
star(* .10 ** .05 *** .01) ///
keep(Autocracy) ///
stats(FE lags N N_g uroot, fmt(%12.0g %12.0g %12.0g %12.0g %6.0f) labels ("Country & year FE " "Four GDP lags" "Observations" "Countries" "p-value, unit root test")) ///
prefoot("hline") ///
postfoot("hlinehline \ end{tabular} ") ///
replace
</code>
//Table
local j = 1
foreach var in A B C D E F G H {
rename `var' Autocracy
qui xtreg ln_gdp Autocracy l(1/4).ln_gdp i.year, fe cluster(code)
llctest ln_gdp (Autocracy) (), lags(3)
mat uroot = r(pvalmain)
xtreg ln_gdp Autocracy l(1/4).ln_gdp i.year, fe cluster(code)
eststo r`j'
qui estadd local FE "Yes", replace
qui estadd local lags "Yes", replace
estadd local uroot "`:di %6.3f uroot[1,1]'", replace
rename Autocracy `var'
local j = `j' + 1
}
esttab r1 r2 r3 r4 r5 r6 r7 r8 using "table.tex", ///
prehead(" defsym#1{ifmmode^{#1}else(^{#1})fi} \ \ begin{tabular}{l*{8}{c}} hlinehline") ///
mtitles("A" "B" "C" "D" "E" "F" "G" "H" ) ///
mgroups("Outcome: Log GDP per capita", pattern(1 0 0 0 0 0 0 0 ) ///
prefix(multicolumn{@span}{c}{) suffix(}) span erepeat(cmidrule(lr){@span})) alignment(D{.}{.}{-1}) ///
label ///
booktabs ///
b(%8.3f) se (%8.3f) ///
star(* .10 ** .05 *** .01) ///
keep(Autocracy) ///
stats(FE lags N N_g uroot, fmt(%12.0g %12.0g %12.0g %12.0g %6.0f) labels ("Country & year FE " "Four GDP lags" "Observations" "Countries" "p-value, unit root test")) ///
prefoot("hline") ///
postfoot("hlinehline \ end{tabular} ") ///
replace