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 on April 23, and its replacement, statalist.org is already up and running.


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

Re: st: Trouble producing MNL table with outreg


From   Wameq Raza <wameq.r@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Trouble producing MNL table with outreg
Date   Mon, 10 Sep 2012 14:51:47 +0200

Hi John,
Thank you so very much for this! It works like a charm!
Best
Wameq

On Sun, Sep 9, 2012 at 10:55 PM, John Luke Gallup <jlgallup@pdx.edu> wrote:
> Wameq,
>
> I think you may have a problem using the option -addtable- for the -outreg- command, if you want to use it to combine tables.  This option creates a new table in the same document as a previous table, but the tables are completely separate.
>
> Otherwise I don't see a problem.  Most of your options listed below have nothing to do with marginal effects per se.
>
> I can produce a table of marginal effects for multinomial logit as follows:
>
> . sysuse auto, clear
> . mlogit rep78 mpg foreign, nolog baseoutcome(1)
>
> If you just use the command
>
> . margins, dydx(*)
>
> you only get the marginal effects for the first outcome of the -mlogit- model.  To get a full table of marginal effects, you have to calculate them for each outcome, and use the -merge- option in -outreg- to combine them:
>
> . margins, dydx(*) predict(outcome(2))
> . outreg, marginal ctitle("",2)
> . margins, dydx(*) predict(outcome(3))
> . outreg, marginal merge ctitle("",3)
> . margins, dydx(*) predict(outcome(4))
> . outreg, marginal merge ctitle("",4)
> . margins, dydx(*) predict(outcome(5))
> . outreg, marginal merge ctitle("",5)
>
> This produces the following table:
>
>                  --------------------------------------------
>                               2       3       4        5
>                  --------------------------------------------
>                   mpg       -0.002  -0.010  -0.003   0.014
>                             (0.23)  (0.92)  (0.34)  (2.40)*
>                   foreign   -1.334  0.859   0.577    0.245
>                             (0.01)  (0.01)  (0.02)  (0.04)
>                   N           69      69      69      69
>                  --------------------------------------------
>                               * p<0.05; ** p<0.01
>
> You can put the same code into a loop:
>
> . outreg, clear
> . forvalues o = 2/5 {
>         qui margins, dydx(*) predict(outcome(`o'))
>         outreg, marginal merge ctitle("",`o') nodisplay
> }
> . outreg, replay
>
> If you still find that -outreg- is not lining up columns as it should, please create an example using Stata's auto.dta dataset so that I can reproduce your code.
>
> John
>
>
> On Sep 8, 2012, at 4:05 PM, Wameq Raza <wameq.r@gmail.com> wrote:
>
>> Hello STATA Users,
>> I just started working with outreg recently and have had no trouble
>> getting tables for my binomial models.
>> But when I tried to get margins tables for a MNL model, the marginal
>> effects and the standard errors come
>> up all over the place. I've specified ctitles but the columns don't
>> follow the titles either. I'm not using "nosub"
>> option, but the standard errors are coming up beside 2 of the columns
>> while the rest are grouped together
>> and appear far below the main table. Here's my syntax:
>>
>> mlogit hwseen_a tfhhh shg lntotalexp ......
>>
>> margins, dydx (_all)
>>
>> outreg using results, marginal ctitle("Variable", "Other", "Pharm",
>> "Public", "Private") title ("MNL results for seeking   ///
>> care for acute illnesses") starloc(1) starlevels(10 5 1) note("The
>> figures show marginal effects and standard errors() for ///
>> each provider") addtable
>>
>> Can anyone suggest what I might be doing wrong?
>>
>> Best
>> Wameq
>>
>>
>>
>> --
>> W A M E Q   R A Z A
>> *
>> *   For searches and help try:
>> *   http://www.stata.com/help.cgi?search
>> *   http://www.stata.com/support/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/statalist/faq
> *   http://www.ats.ucla.edu/stat/stata/



-- 
W A M E Q   R A Z A
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


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