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]

Re: st: xtmelogit convergence issues and log transforming IVs

From   Maarten Buis <>
Subject   Re: st: xtmelogit convergence issues and log transforming IVs
Date   Wed, 25 Jan 2012 10:29:39 +0100

On Tue, Jan 24, 2012 at 9:53 PM, William Hauser  wrote:
> The outcome is dichotomous so I'm
> using the xtmelogit command.  Stata is version 12, intercooled.
> The problem is that the model simply will not converge unless I
> transform two of the predictor variables which are, in their
> untransformed form, highly overdispersed.
> Problem is, I'm not sure how to interpret the resulting odds ratios
> for the log transformed predictor variables

I generally like to use linear splines for such cases, which you can
create using -mkspline-.

> gen log_priors=(ln(prior_record)/ln(1.10)
> (a bunch of missing values result for all those cases where the
> offender has no prior record)
> replace log_priors=0 if prior_record==0
> gen no_priors=0
> replace no_priors=1 if prior_record==0

This is not too problematic. It says that there is a smooth (though
hard to interpret) relation between prior record and whatever your
outcome is and a sudden kink in that relationship at 0 (no prior
record). I can see how something like that can make substantive sense.
However, I would first try this transformation (the extra dummy for 0
prior convictions) before adding the complication of logging your
prior record. It may very well be that that is enough to solve your
problem, and than you have all interpretable coefficients.

consider the example below, which uses both the "additional dummy for
special values strategy" and the "linear spline strategy". Within the
group of respondents with 10 years of experience (c_ttl_exp=0), who
are working 40 hours per week (c_hours=0 and h40=1), and who have high
school as their highest achieved level of education (c_grade=0) we
expect to find .25 persons with a higher occupation for every person
with a lower occupation. This odds increases by 18 % ((1.18-1)*100%)
for every year extra experience if one has less than 10 years
experience and only a non-significant 5 % per year if one has more
than 10 years experience. An extra hour per week work is associated
with a 3% increase in the odds and there is a non significant penalty
for working the regular (40) amount of of hours per week of a 5%
decrease in the odds of having a high occupation.

*--------------------- begin example -------------------
sysuse nlsw88, clear

// generate the dependent variable
gen byte high_occ = ( occupation < 3 ) if occupation < .

// center experience and create spline
gen c_ttl_exp = ttl_exp - 10
mkspline sp1 0 sp2 = c_ttl_exp

// center hours and add dummy for 40 hours/week
gen c_hours = hours - 40
gen byte h40 = ( hours == 40 ) if hours < .

// center grade
gen c_grade = grade - 12

// estimate the model
logit high_occ sp1 sp2 c_hours h40 c_grade, or
lincom _cons + h40, or
*---------------------- end example --------------------
(For more on examples I sent to the Statalist see: )

Hope this helps,

Maarten L. Buis
Institut fuer Soziologie
Universitaet Tuebingen
Wilhelmstrasse 36
72074 Tuebingen

*   For searches and help try:

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