Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: Re: st. outreg and multinomial logit


From   "Alexander Nervedi" <alexnerdy@hotmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   st: Re: st. outreg and multinomial logit
Date   Mon, 14 Mar 2005 03:25:24 +0000

Hi Daniel and Clive,

Thanks for your responses;

Daniel suggestion (attached below) works smoothly and i leanrt that outreg doesn't like spaces in value labels.

Clive's recommendation is also good. Though with a few dozen outreg commands to fix I will stay with outreg for now and try out the "estout" package.

Thanks again.


Recommended solutions:


make sure you don't have spaces in the value labels.

e.g., this will not work:
lab def mylab 1 "one two" 2 "three four"

But this will:
lab def mylab 1 "one_two" 2 "three_four"
(note the underscores!)

Hope that helps,
Daniel



From: "Clive Nicholas" <Clive.Nicholas@newcastle.ac.uk>
Reply-To: statalist@hsphsun2.harvard.edu
To: statalist@hsphsun2.harvard.edu
Subject: Re: st: outreg and multinomial logit
Date: Mon, 14 Mar 2005 02:26:01 -0000 (GMT)

Alexander Nervedi wrote:

> I have been trying to get outreg to work after a multi-nomial logit
> estimation and outreg keeps balking.
> So the ordered outcome variable has three scales .. None(0), Any(1), and
> All(2); the base level is None. outreg keep complaing that "equation any
> not
> found"
>
> The comand I am using is :
>
> .mlogit y $x1 $x2, basecategory (0)
> .outreg using mnl-model, 3aster bracket coefastr se replace comma
> equation Any not found
>
> My suspicion is that outred is looking to associate values (SD, Z value,
> P
> value, CI) with Any when it appears in the table as a normal output of
> the
> mlogit command, and is protesting becuase there isnt any such values.
>
> A suggestion for a workaround would be really helpful.

There are two solutions to this problem.

Using -outreg-, one answer is:

. outreg using "C:\DATA\mlogit.out", eform bdec(3) rdec(3) sigsymb(*,**)
coefastr se addstat(Model chi-square, e(chi2), df, e(df_m), Log
likelihood, e(ll), Pseudo R2, e(r2_p), N of observations, e(N))

However, why not use Ben Jann's -estout-, downloadable from SSC, which, in
the view of a growing number of Stata users (including myself) is
superior. An example:

. use http://www.stata-press.com/data/r8/sysdsn3.dta
(Health insurance data)

. mlogit insure age male nonwhite, basecat(1)

Iteration 0: log likelihood = -555.85446
Iteration 1: log likelihood = -545.60089
Iteration 2: log likelihood = -545.58328
Iteration 3: log likelihood = -545.58328

Multinomial logistic regression Number of obs = 615
LR chi2(6) = 20.54
Prob > chi2 = 0.0022
Log likelihood = -545.58328 Pseudo R2 = 0.0185
----------------------------------------------------------------------------
insure | Coef. Std. Err. z P>|z| [95% Conf. Interval]
-----------+----------------------------------------------------------------
Prepaid |
age | -.0111915 .0060915 -1.84 0.066 -.0231305 .0007475
male | .5739825 .2005221 2.86 0.004 .1809665 .9669985
nonwhite | .7312659 .218978 3.34 0.001 .302077 1.160455
_cons | .1567003 .2828509 0.55 0.580 -.3976773 .7110778
-----------+----------------------------------------------------------------
Uninsure |
age | -.0058414 .0114114 -0.51 0.609 -.0282073 .0165245
male | .5102237 .3639793 1.40 0.161 -.2031626 1.22361
nonwhite | .433314 .4106255 1.06 0.291 -.3714972 1.238125
_cons | -1.811165 .5348606 -3.39 0.001 -2.859473 -.7628577
----------------------------------------------------------------------------
(Outcome insure==Indemnity is the comparison group)

. tab insure

insure | Freq. Percent Cum.
------------+-----------------------------------
Indemnity | 294 47.73 47.73
Prepaid | 277 44.97 92.69
Uninsure | 45 7.31 100.00
------------+-----------------------------------
Total | 616 100.00

. ereturn list

scalars:
e(N) = 615
e(ll_0) = -555.8544590054535
e(ll) = -545.5832760024657
e(df_m) = 6
e(chi2) = 20.54236600597551
e(r2_p) = .0184781876561091
e(basecat) = 1
e(ibasecat) = 1
e(k_cat) = 3

macros:
e(depvar) : "insure"
e(cmd) : "mlogit"
e(crittype) : "log likelihood"
e(predict) : "mlogit_p"
e(eqnames) : "`"Prepaid"' `"Uninsure"'"
e(chi2type) : "LR"

matrices:
e(b) : 1 x 8
e(V) : 8 x 8
e(cat) : 1 x 3

functions:
e(sample)

. est store model

. estout model, stats(r2_p chi2 N, labels("Pseudo R-squared" "Model
chi-square" "N")) cells(b(star fmt(%9.2
> f)) t(par)) varwidth(30) modelwidth(10) label unstack

model
Prepaid Uninsure
b/t b/t
NEMC (ISCNRD-IBIRTHD)/365.25 -0.01 -0.01
(-1.84) (-0.51)
NEMC PATIENT MALE 0.57** 0.51
(2.86) (1.40)
nonwhite 0.73*** 0.43
(3.34) (1.06)
_cons 0.16 -1.81***
(0.55) (-3.39)
Pseudo R-squared 0.02
Model chi-square 20.54
N 615.00

I hope that helps.

CLIVE NICHOLAS |t: 0(044)7903 397793
Politics |e: clive.nicholas@ncl.ac.uk
Newcastle University |http://www.ncl.ac.uk/geps

*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/
_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today - it's FREE! http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/

*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* 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   |   What's new   |   Site index