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: Mlogit with factor variables
From
Maarten Buis <[email protected]>
To
[email protected]
Subject
Re: st: Mlogit with factor variables
Date
Tue, 22 Jan 2013 14:23:35 +0100
On Tue, Jan 22, 2013 at 1:50 PM, Saki Tapsell wrote:
> I run the multinomial logit model with using y as dependent variable,
> and sector and firm_size as independent variables.
>
> "Sector" is a factor variable (1 = food, 2 = tobacco, 3 = textiles, 4
> = apparel).
>
> I can do:
>
> mlogit y ib1.sector firm_size
>
> But the tobacco sector has a very small sample, so I don't want to
> include that but without dropping that data entirely. So I do:
>
> mlogit y i1.sector i3.sector i4.sector firm_size
>
> Which seems to work. mlogit uses sector == 1 as the base.
That must be incorrect. With that syntax Stata must use sector==2 as
the base, which is not what you wanted
> But now I want to use the command "prchange" which doesn't like factor
> variables. So I have to convert this to dummy variables. But if I
> do:
>
> mlogit y sector1 sector3 sector4 firm_size
>
> Then it no longer uses sector1 as the base. and I think treats them
> as binary independent variables.
It is equivalent to your previous (wrong) syntax: the base is sector == 2.
You have two options: either you drop all tobacco industries or you
merge the category tobacco with some other category, probably food.
For the first option type:
drop if sector == 2
or alternatively (better):
gen byte touse = ( sector != 2 )
mlogit y i.sector firm_size if touse == 1
I often abreviate this as:
mlogit y i.sector firm_size if touse
For the second option type
gen sector2 = sector
replace sector2 = 1 if sector2 == 2
mlogit y i.sector2 firm_size
Hope this helps,
Maarten
---------------------------------
Maarten L. Buis
WZB
Reichpietschufer 50
10785 Berlin
Germany
http://www.maartenbuis.nl
---------------------------------
*
* 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/