Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: Re: Stata package -diagt- version 2.0.5. - correction


From   Paul Seed <[email protected]>
To   "Alessandro A. Leidi" <[email protected]>, "[email protected]" <[email protected]>
Subject   st: Re: Stata package -diagt- version 2.0.5. - correction
Date   Tue, 12 May 2009 13:53:39 +0100

Dear Allesandro,

In fact, having tried out a few simulations,
I would not recommend using -bootstrap- with -diagt-.
The binomial distribution is thoroughly explotred, and
there are much better ways than bootstrapping of putting
a confidence interval round a percentage. Several are available in Stata (Wilson Agresti, Jefreys, Exact),
using -ci- or -cii- with much less trouble.

If you do want to, (and I advise against) you need to use options
-bca- and -strata()- with -bootstrap-. The program below
works correctly; (the previous one had true & test confused)
Remove or change the sample -diagti- command to suit your data.
Increase the number of reps to the maximum you can wait for.


Correction to program follows:

*****************************
prog drop _all

prog define mydiagt, rclass
*! mydiagt version 1.0.1 written 12 May 2009 by PT Seed ([email protected])
*! stripped-down version of -diagt- for use with -bootstrap- command.
*! bug in version 1.0 fixed.

* Note: this assumes that values are 0 and 1 only.

version 6.0
* Syntax
   syntax varlist(min=2 max=2 numeric) [if]
   tempvar touse
   mark `touse' `if'

   tokenize  "`varlist'"
   local true `1'
local test `2' su `test' if `true' == 1 & `touse', meanonly
   return scalar sens = r(mean)
   su `test' if `true' == 0 & `touse', meanonly
   return scalar spec = (1-r(mean))
end mydiagt

clear
diagti 4 2 7 37
qui bootstrap sens=r(sens) spec=r(spec), strata(true) reps(10000) bca: mydiagt true test
estat bootstrap, all



--
Paul T Seed MSc CStat CSci, Senior Lecturer in Medical Statistics,
tel  (+44) (0) 20 7188 3642, fax (+44) (0) 20 7620 1227
Wednesdays: (+44) (0) 20 7848 4208
[email protected], [email protected]

King's College London, Division of Reproduction and Endocrinology
St Thomas' Hospital, Westminster Bridge Road, London SE1 7EH

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   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