Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at

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

st: RE: FIRTHLOGIT with factor (categorical variables)

From   Nick Cox <>
To   "''" <>
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.

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. 


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

© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index