[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 <>
To   "Alessandro A. Leidi" <>, "" <>
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 (
*! 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

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,

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

*   For searches and help try:

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