Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: st: xi3 / nlogit
From
Michael Mitchell <[email protected]>
To
[email protected]
Subject
Re: st: xi3 / nlogit
Date
Fri, 3 Dec 2010 16:31:22 -0800
Dear Nils
When I wrote -xi3-, I don't think these models existed (or if they
did, I did not have them in mind). So, unfortunately, -xi3- does not
immediately work with programs like -xtmixed-, or -nlogit-, because it
gets confused by the pipes -||-. However, you can still use -xi3- if
you do it in a two step process. For example, here is using -xi3- in a
one step process to do a regression
. sysuse auto
(1978 Automobile Data)
. xi3: regress price e.rep78 g.foreign
e.rep78 _Irep78_1-5 (naturally coded; _Irep78_1 omitted)
g.foreign _Iforeign_0-1 (naturally coded; _Iforeign_0 omitted)
Source | SS df MS Number of obs = 69
-------------+------------------------------ F( 5, 63) = 0.19
Model | 8372481.37 5 1674496.27 Prob > F = 0.9670
Residual | 568424478 63 9022610.75 R-squared = 0.0145
-------------+------------------------------ Adj R-squared = -0.0637
Total | 576796959 68 8482308.22 Root MSE = 3003.8
------------------------------------------------------------------------------
price | Coef. Std. Err. t P>|t| [95% Conf. Interval]
-------------+----------------------------------------------------------------
_Irep78_2 | 188.879 1024.352 0.18 0.854 -1858.124 2235.882
_Irep78_3 | 646.8116 710.873 0.91 0.366 -773.7548 2067.378
_Irep78_4 | 274.3754 799.3802 0.34 0.733 -1323.059 1871.809
_Irep78_5 | 104.1799 1036.513 0.10 0.920 -1967.126 2175.486
_Iforeign_1 | 36.7572 1010.484 0.04 0.971 -1982.533 2056.048
_cons | 5797.125 581.597 9.97 0.000 4634.896 6959.353
------------------------------------------------------------------------------
Instead, we can first use -xi3- to create the coded variables....
. xi3 e.rep78 g.foreign
e.rep78 _Irep78_1-5 (naturally coded; _Irep78_1 omitted)
g.foreign _Iforeign_0-1 (naturally coded; _Iforeign_0 omitted)
And then we can include the coded variables into the model, as shown below.
. regress price _Irep78_2 _Irep78_3 _Irep78_4 _Irep78_5 _Iforeign_1
Source | SS df MS Number of obs = 69
-------------+------------------------------ F( 5, 63) = 0.19
Model | 8372481.37 5 1674496.27 Prob > F = 0.9670
Residual | 568424478 63 9022610.75 R-squared = 0.0145
-------------+------------------------------ Adj R-squared = -0.0637
Total | 576796959 68 8482308.22 Root MSE = 3003.8
------------------------------------------------------------------------------
price | Coef. Std. Err. t P>|t| [95% Conf. Interval]
-------------+----------------------------------------------------------------
_Irep78_2 | 188.879 1024.352 0.18 0.854 -1858.124 2235.882
_Irep78_3 | 646.8116 710.873 0.91 0.366 -773.7548 2067.378
_Irep78_4 | 274.3754 799.3802 0.34 0.733 -1323.059 1871.809
_Irep78_5 | 104.1799 1036.513 0.10 0.920 -1967.126 2175.486
_Iforeign_1 | 36.7572 1010.484 0.04 0.971 -1982.533 2056.048
_cons | 5797.125 581.597 9.97 0.000 4634.896 6959.353
------------------------------------------------------------------------------
I know it is a kludge, but I hope it works for you.
Best regards,
Michael N. Mitchell
Data Management Using Stata - http://www.stata.com/bookstore/dmus.html
A Visual Guide to Stata Graphics - http://www.stata.com/bookstore/vgsg.html
Stata tidbit of the week - http://www.MichaelNormanMitchell.com
On Fri, Dec 3, 2010 at 4:07 PM, Nils Wlömert <[email protected]> wrote:
> Dear listers,
>
> I would like to use effect-coding (via xi3) with nlogit:
>
> xi3: nlogit decision p_ppd p_fl e.p_drm e.fl_drm e.ad e.cat e.nobuy || type:
> || alternative:, noconst case(case_1)
>
> However, I get the following error:
>
> "|" invalid name
> r(198);
>
> Does xi3 work with nested models at all?
>
> Estimation works fine without effect-coding via xi3.
>
> Many thanks!
>
> Nils
> *
> * 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/