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 at the end of May, and its replacement, statalist.org is already up and running.


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

st: RE: FIRTHLOGIT with factor (categorical variables)


From   Nick Cox <n.j.cox@durham.ac.uk>
To   "'statalist@hsphsun2.harvard.edu'" <statalist@hsphsun2.harvard.edu>
Subject   st: RE: FIRTHLOGIT with factor (categorical variables)
Date   Tue, 21 Sep 2010 14:53:19 +0100

First off, although a small point, there is no need for IDIOSYNCRATIC CAPITALISATION. "Stata" is precisely so named and as explained in the Statalist FAQ we have a -foobar- convention on this list for indicating Stata command names. 

Second, and another small point, -firthlogit- is a program, not a macro, in Stata terms. 
See e.g. http://www.stata.com/statalist/archive/2008-08/msg01258.html

Now to address your main point: -firthlogit- was written in 2008 for Stata 9.2 and so was quite unable to anticipate the factor variable additions introduced later in Stata 11. -findit firthlogit- reveals only what you downloaded. If the author, Joseph Coveney, is sitting on a more up-to-date version he will no doubt say so. 

One suggestion is that you indeed try using -firthlogit- in conjunction with -xi:-. If this is extremely slow, I doubt that can be blamed on two different ways of handling factor variables. What -xi- does is, in my understanding, computationally trivial, although tedious for humans. 

But to be sure you could just generate the indicator variables yourself to find out. 

Nick 
n.j.cox@durham.ac.uk 

Warren Chow

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.

*
*   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