Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: Bootstraped nadirs with 95% CI's for frac poly approximations


From   Stas Kolenikov <[email protected]>
To   [email protected]
Subject   Re: st: Bootstraped nadirs with 95% CI's for frac poly approximations
Date   Tue, 17 Aug 2004 16:29:14 -0400 (EDT)

> I am looking at data that relates continuous change in an outcome as a
> function of time (cesarean delivery is the outcome and the time is the
> day of gestational age in the term period of pregnancy when delivery
> occurs (37 weeks - 42 weeks gestation). Different numbers of patients
> have delivered on different days but the percentage of patients having a
> cesarean delivery per day seems to change continuously with increasing
> gestational age at delviery. I have been able to generate a weighted
> frac poly curve to approximate these relationships and I find that there
> is a low point in the curve - an optimal time of delivery!.
>
> I have been able to capture this low point (nadir) within the frac poly
> curve by requesting the 1st percentile value. However, I would like to
> estimate the 95% CI around this point for both the x and y coordinates
> (e.g. a 95% CI around both both gestational age and rate of outcome). I
> think this requires bootstrapping but I can't seem to make it work.

Here's the trick you may want to think of. If you ran a quadratic
regession y=b0+b1*x+b2*x^2, then the location of the minimum is given by
xmin = -b1/(2*b2). This is something you can put a CI around with -nlcom-.
Now, the question is then whether your regression is convertible to that
format. You can also try to derive the local minimum from your -fracpoly-
specification, but your standard errors will be underestimated due to the
fact that you have fitted several different models, and Stata chose the
best fitting one.

If you want to use the bootstrap (which I strongly advocate against in a
few postings back), you would need to write a program of the following
kind:

program define MyBS, rclass
  version 8.2
  args y x
  fracpoly reg `y' `x'
  tempvar yhat
  fracpred `yhat'
  sort `yhat'
  ret scalar xmin = `x'[1]
  ret scalar ymin = `y'[1]
end

I tried it with the following data:

sysuse nlsw88
g ilwage = -log(wage)
bootstrap "MyBS ilwage age" r(ymin) r(xmin) , rep(200) dots

to find the best earning age. Some time between 35 and 40, according to
this data.

 ---                                    Stas Kolenikov
 --       Ph.D. student in Statistics at UNC-Chapel Hill
 - http://www.komkon.org/~tacik/  -- [email protected]

* This e-mail and all attachments to it are not intended to provide any
* reasonable point of view and was transmitted to you in error. It
* should be immediately deleted by all recipients unless they really
* enjoy communicating with the author :). Other restrictions apply.


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