Statalist The Stata Listserver


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

st: reproducing what -mfp- does: gen y = ln(X) + constant where X may equal zero


From   "daniel waxman" <[email protected]>
To   <[email protected]>
Subject   st: reproducing what -mfp- does: gen y = ln(X) + constant where X may equal zero
Date   Fri, 24 Mar 2006 11:06:08 -0500

I am trying (without so much luck) to explain to a reviewer how I am setting
up my logistic regression model.

Briefly, the dependent variable, first_trop, is a continuous variable, and
about half the values are zero.
What I want to do is replace the univariate model with a bivariate one which
uses one term for values of first_trop>0 and a dummy variable for
first_trop=0.  The tricky part is, the best transformation for the
continuous part is a logarithmic transformation.  I had done it a slightly
different way, but -mfp- does the same thing:

. mfp logistic is_dead first_trop , catzero(first_trop)

and -mfp- does the following transformation:


-> gen double Ifirs__1 = ln(X)+3.42714503 if e(sample) 
   (where: X = first_trop/10)
-> gen byte Ifirs__0 = first_trop<=0 if e(sample) 



The question is:  If I do the same thing manually, ln(X) is missing if
first_trop=0, and a missing number plus a constant is still missing.  But
-mfp- manages to do it without dropping the observations where first_trop==0

Can anyone help explain how this is happens, or how I can justify it?

Many thanks.


*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



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