Hello Statalisters,
i'm investigating the effect of wealth on charitable donations. For this i'am running a heckman-regression on donations, a dummy for donations yes/no, wealth and a number of control- and selection-variables.
Now, i'd like to report margins or some other effects and i'd prefer to retrieve the margins via esttab/estout, first because it's simple, secondly because it looks good.
As far as my understanding goes, esttab retrieves the parameters values, summary-statistics, etc, stata stores in eststo. Margins usually does not store it's results there (or anywhere permanently, as far as i know), except if one uses the post-option or the estpost margins command.
The problem is that by specifying these options i seem to override all the input from my heckman-estimation, so that i can not use margins, post consecutively but rather only ones after the heckman-estimation. At least, regardless of the command i use (estpost margins or margins, post) when i want to use it a second time without reestimating the heckman, i get the following error-message:
Now my question: is there any way of using multiple, consecutive margin-commands, store the results and retrieve them via esttab (or something which is as convenient)?
This is my code:
My results. 
To get the results, i used estimates replay, where no information on svy is given:
Number of Strata: 1
Number of PSUs: 2121
Many thanks in advance,
Caspar
i'm investigating the effect of wealth on charitable donations. For this i'am running a heckman-regression on donations, a dummy for donations yes/no, wealth and a number of control- and selection-variables.
Now, i'd like to report margins or some other effects and i'd prefer to retrieve the margins via esttab/estout, first because it's simple, secondly because it looks good.
As far as my understanding goes, esttab retrieves the parameters values, summary-statistics, etc, stata stores in eststo. Margins usually does not store it's results there (or anywhere permanently, as far as i know), except if one uses the post-option or the estpost margins command.
The problem is that by specifying these options i seem to override all the input from my heckman-estimation, so that i can not use margins, post consecutively but rather only ones after the heckman-estimation. At least, regardless of the command i use (estpost margins or margins, post) when i want to use it a second time without reestimating the heckman, i get the following error-message:
margins cannot work with its own posted results
r(322);
r(322);
This is my code:
Code:
* prepare locals #delimit ; local wealth = c.wealth_norm##(c.wealth_norm#c.wealth_norm); local control = ib5.wealth_perc ib0.soc_eng_2011 ib0.child_dum ib4.age_gr ib4.gross_gr ib1.sex ib3.casmin_comp ib1.migback ib3.hlf0261 ib0.unempl ib1.loc1989; local income = c.netinc_norm##(c.netinc_norm#c.netinc_norm); local inherit = c.inherit_norm##(c.inherit_norm#c.inherit_norm); local selection = ib0.married ib0.retired ib0.inherit_dum; #delimit cr svy:heckman lgivings ib0.hvid `wealth' `income' `inherit' /// `control' `weight', /// select(givings_dum = ib0.hvid `wealth' `income' `inherit' /// `control' `selection') eststo heckman * effect of employing people on donations * estpost margins hlf0261, pred(ycon) eststo marginhlfdon *** The last command is not working, stata returns error-message as described *** * effect of employing people on probability to donate donations * estpost margins hlf0261, pred(psel) eststo marginhlfprob
To get the results, i used estimates replay, where no information on svy is given:
Number of Strata: 1
Number of PSUs: 2121
Many thanks in advance,
Caspar
Comment