Regarding Nicks comment on replacing log(0) with zero:
It may not be pretty, but it does work!
If zdose=0 when dose=0, 1 otherwise
and ldose=log(dose) for the condition dose!=0, zero otherwise
then you are fitting the model:
xb =b [zdoseXldose]*zdose*ldose + b[zdose]*zdose + b[cons]
so when dose=0 the first two terms drop out and the coefficient for the constant represents dose=0.
In all other cases, all 3 terms remain.
It might be more palatable if you replace all the zeroes in the preceding discussion with a *very small number*
For the record, this gives exactly the same result as using the catzero option with Patrick Royston's -mfp- routine.
See
. help mfp
Dan
-----Original Message-----
From: "Nick Cox" <[email protected]>
Subj: RE: st: reverse prediction - confidence interval for x at given y in nonlinear model
Date: Fri Oct 26, 2007 9:15 am
Size: 1K
To: <[email protected]>
The idea of a dummy for zero dose is interesting but doesn't seem to map
on the kind of model being discussed here.
More importantly, that does nothing to solve the major issue, which is
thinking up a good alternative to log(0). Replacing log(0) by 0 is
equivalent to replacing 0 by 1 in whatever units are being used. How
sensible that is will depend partly on the range of the data. If the
rest of the data were 0.1 to 0.5 it would be crazy!
The problem in general is that mapping 0 to a very small number creates
a very large negative logarithm. Although I guess that there must be
other solutions, one is to do a sensitivity analysis of varying choices
of c in log(x + c), or cond(x == 0, c, log(x)).
Nick
[email protected]
Daniel Waxman
Regarging the treatment of zeroes in log(dose):
Since zero likely reflects a qualitatively different situation than
small values of dose you are better off treating it as such. Here is a
trick to get stata to do what you want:
gen ldose = log(dose)
gen zdose = 1 - (dose == 0)
replace ldose = 0 if dose == 0
logit outcome ldose zdose ...
Thus ldose is a term which represents log dose for positive values, and
falls out for doses of zero. zdose is a dummy which is zero for doses
of zero and one otherwise. If you look at the model as:
logit outcome ldose*zdose zdose
and look at what happens as dose (untransformed) becomes infinitesimal,
you can see how this works.
*
* 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/
--- message truncated ---
*
* 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/