Statalist


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

RE: st: reverse prediction - confidence interval for x at given y in nonlinear model


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   RE: st: reverse prediction - confidence interval for x at given y in nonlinear model
Date   Fri, 26 Oct 2007 19:21:58 +0100

We have been at cross purposes. 

Your log(0) as 0 is, I see, only a trick that keeps 
the zeros in the frame _so long as you also have a dummy 
for 0_. 

My point is that it does not help in problems in which there is no dummy
for 
0. 

Suppose your doses are 0 0.1 0.2 0.3 0.4 0.5
in whatever units are being used. Neither Stata nor the mathematics
knows about the units. 

Then the recipe cond(dose == 0, 0, log(dose)) is not even monotonic
in dose. 0 is treated as if were larger than any other positive
value in the data! 

Also if any dose is 1, this recipe treats 0 and 1 as 
equivalent. 

Nick
[email protected] 


-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Daniel Waxman
Sent: 26 October 2007 19:07
To: [email protected]
Subject: RE: st: reverse prediction - confidence interval for x at given
y in nonlinear model

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/

*
*   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