I am running a logit model, and doing a non-linear test afterwards. I want to display the test statistic and p-value from the test, not the coefficients from the logit. Here is a MWE:
sysuse auto, clear
eststo clear
logit foreign price
testnl -_b[_cons]/_b[price] = 0
estadd scalar mycoef = r(R)[1,1] // The test statistic value
estadd scalar mypval = r(p) // Chi^2 P-Value
esttab, main(mycoef) aux(mypval)
This does not work:
. esttab, main(mycoef) aux(mypval)
----------------------------
(1)
foreign
----------------------------
foreign
price
_cons
----------------------------
N 74
----------------------------
mycoef coefficients; mypval in parentheses
* p<0.05, ** p<0.01, *** p<0.001
One option is to use the stats
option from estout
, and that works fine. I can specify cells(none)
and stats(mycoef mypval)
:
. esttab, cells(none) stats(mycoef mypval)
-------------------------
(1)
foreign
-------------------------
mycoef 30605.99
mypval .601552
-------------------------
That said, it would be nice to be able to utilize the stats section for other things (mainly keeping the divider there), and getting nice formatting options like parentheses for the p value.
Basically, I want to know, generally, how to put things in main() and aux(), because it seems very difficult to do if its not from a built-in function like vif
. I think the answer has to do with using matrices, but I tried using estadd matrix
with many iterations of changing columns titles and equations to no avail.