[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

RE: st: log of zero

From   "Nick Cox" <>
To   <>
Subject   RE: st: log of zero
Date   Wed, 2 Jul 2008 12:15:44 +0100

As I understand it, -glm, link(log)-, although otherwise white magic of
the best Dumbledore kind, can do nothing to help with zeros in a
predictor that you want to log. 


Maarten buis

--- Viktor Slavtchev <> wrote:
> I want to estimate production function in logs in order to interpret
> the coefficients in terms of elasticities. one of the RHS variables
> has a lot of zero value. in such cases, some people usually add a
> very small value in order to avoid the problem of 'undefined' log of
> zero. a similar issue was discussed some time ago among other things
> and in a quite different context but an interesting alternative
> suggestion was made (which I can't remember anymore). unfortunately,
> I was not able to find this particular thread.

I think you are refering to using -glm- with the log link, like in the
example below. 

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

/* create some zeros */
recode grade 0/11 = 0

gen lnage = ln(age)
xi: glm grade lnage i.race south, link(log)
*----------- end example ------------------
(For more on how to use examples I sent to the Statalist, see )

When searching the archive of Statalist it may be helpful to know that
in the archive of the statalist hosted by StataCorp there is a good
search function, see:

*   For searches and help try:

© Copyright 1996–2017 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index