Bookmark and Share

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]

st: Re: FIRTHLOGIT with factor (categorical variables)


From   "Joseph Coveney" <[email protected]>
To   <[email protected]>
Subject   st: Re: FIRTHLOGIT with factor (categorical variables)
Date   Wed, 22 Sep 2010 01:10:08 +0900

Warren Chow wrote:

I am trying to do a logistic regression in STATA for a dichotomous output
variable y using various categorical predictors. One of these predictors,
x1, has many levels. The goal is produce linear predictions (predict
linearx1, xb) so I can perform another logistic regression with the
remaining predictors (logit y linearx1 i.x2 i.x3 i.x4).  

The first logistic regression encounters complete and quasi separation at
various stages using the standard maximization techniques provided by stata.
I would like to use a Firth  penalized maximum likelihood estimation and
have downloaded the FIRTHLOGIT macro from
http://ideas.repec.org/c/boc/bocode/s456948.html#abstract. This technique
previously successfully linearized x1 using SAS. However, FIRTHLOGIT does
not support factor (categorical) variables. For example, in the newer
versions of STATA, you can use:

logit y i.x

But the following does not work:

firthlogit y i.x

Is there another version of the macro that supports factor variables, or an
easy way to modify to code? I have tried the following:

xi : firthlogit y i.x

But this is extremely slow.

--------------------------------------------------------------------------------

I assume that you meant

xi: firthlogit y i.x1

Try -contract y x1, freq(count)- and then use -firthlogit- with frequency 
weights.  No satisfaction guaranteed, but it might be faster.

What's your SAS code like?  Can you share it with the list?

Joseph Coveney

sysuse auto
contract rep78 foreign, freq(count)
xi i.rep78
firthlogit foreign _I* [fweight=count]
exit


*
*   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–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index