Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down at the end of May, and its replacement, statalist.org is already up and running.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: marginal effects from probit with baseline using estout


From   "Dimitriy V. Masterov" <dvmaster@gmail.com>
To   Statalist <statalist@hsphsun2.harvard.edu>
Subject   Re: st: marginal effects from probit with baseline using estout
Date   Mon, 22 Apr 2013 11:37:51 -0700

I think I hacked something together that works reasonably well:

#delimit;
set more off;
clear all;
webuse union, clear;
tabstat union , by(year);
probit union ib(80).year, robust;
di normal(_b[_cons]);

/* Get the baseline with CI (round to 3 digits) */
estadd margins, at((zero) _continuous (base) _factor);
matrix define M = e(margins_table);
estadd local bl "`=round(M[rownumb(M,"b"),1],0.001)'";
estadd local blci
"[`=round(M[rownumb(M,"ll"),1],0.001)',`=round(M[rownumb(M,"ul"),1],0.001)']";

/* Get the AMEs */
estpost margins, dydx(year);

/* LaTeX Table */
esttab using AME.tex,
cell(b(fmt(3) star) ci(fmt(3)par))
stats(bl blci N, fmt(%12.0fc) label("Baseline" " " "Obs"))
drop(80b.year)
mtitle("AME & 95% CI")
collabels(none)
title("AME")
replace;

cat AME.tex;

On Sun, Apr 21, 2013 at 4:46 PM, Dimitriy V. Masterov
<dvmaster@gmail.com> wrote:
> I am trying to put the average marginal effects with CIs from a probit
> regression into a LaTeX table, along with the base line rate and its
> CI. Here's my attempt at this:
>
> #delimit;
> clear all;
> webuse union, clear;
> tabstat union , by(year);
> probit union ib(80).year, robust;
> di normal(_b[_cons]); // baseline
> estadd margins, at((zero) _continuous (base) _factor); // baseline
> estpost margins, dydx(year); // AMEs
>
> esttab using AME.tex, cell(b(fmt(3) star) ci(fmt(3)par) margins_b)
> stats(N, fmt(%12.0fc)) drop(80b.year) mtitle("AME & 95% CI") collabels(none)
> title("AME") replace;
> cat AME.tex;
>
> The baseline rate CIs are obviously missing and the formatting is off.
> All the statistics I need are is in e(margins_table), but I am not
> sure how to "estadd" those elements to the LaTeX table. Any
> suggestions are much appreciated.
>
> DVM
> *
> *   For searches and help try:
> *   http://www.stata.com/help.cgi?search
> *   http://www.stata.com/support/faqs/resources/statalist-faq/
> *   http://www.ats.ucla.edu/stat/stata/
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index