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: logit transformation of RHS variable

From   Maarten Buis <>
Subject   Re: st: logit transformation of RHS variable
Date   Thu, 5 Jan 2012 10:23:00 +0100

On Thu, Jan 5, 2012 at 12:21 AM, Raymond Lim wrote:
> I have an independent variable that I believe that needs to be
> transformed because it's bounded between 0 and 1, and it's easier to
> go from 0 to .10 than say .80 to .90. My question is, can I use a
> logit transformation on this RHS variable (new_x = x / (1 - x)? Or are
> logits usually for LHS variables only?

For independent/explanatory/right-hand-side/x variables it doesn't
matter whether it is easier to go from 0 to .10 than from .50 to .60,
it matters whether you think that these .10 changes have a different
effects on your dependent/explained/left-hand-side/y variable. My
favourite way of looking at potential non-linearity is to use linear
splines. To me that represents a nice trade-off between allowing the
effect to be non-linear and interpretable parameters.

Consider the example below. The lightest domestic car can expect 33
miles per gallon and a foreign car 2 miles per gallon less. Within the
range .88 to 1.28 short tons the milleage decreases by 23 mpg per ton,
within the range1.28 to 1.68 tons the milleage decreases by 12 mpg per
ton, within the ranges 1.68 to 2.08 tons and 2.08 to 2.42 (the
maximum) the milleage decreases by 9 mpg per ton. So the effect of
weight on milleage seems to be steadily decreasing, which I am told
makes substantive sense.

*--------------------- begin example ---------------------
sysuse auto, clear

// use more reasonable metric for weight
// and center at the lightest car
gen w_ton = weight/2000 - .88
label var w_ton "weight in short tons - .88 ton (the minimum)"

// create splines
// with knots at roughly equal length and "nice" numbers
mkspline sp1 .4 sp2 .8 sp3 1.2 sp4 = w_ton

// estimate model
reg mpg sp* foreign
*---------------------- end example ----------------------
(For more on examples I sent to the Statalist see: )

Hope this helps,

Ps. note that your variable new_x is not a logit transform of x. To do
that you need to type -gen new_x = ln(x / (1 - x))- or -gen new_x =

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