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

From |
Paul Seed <paul.seed@kcl.ac.uk> |

To |
"Alessandro A. Leidi" <a.a.leidi@reading.ac.uk>, "statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu> |

Subject |
st: Re: Stata package -diagt- version 2.0.5. |

Date |
Tue, 12 May 2009 13:18:28 +0100 |

Dear Allesandro,

are based on the exact Binomial distribution. In fact, if you do not use the -bca- option with bootstrap, you will get symmetrical intervals based on 1.96 SE, which are definitely worse.

I have done this below for diagt. ***************************** prog drop _all prog define mydiagt, rclass *! mydiagt version 1.0 written 12 May 2009 by PT Seed (paul.seed@kcl.ac.uk) *! stripped-down version of -diagt- for use with -bootstrap- command. * Note: it assumes that values of test & true variables 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'

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

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

paul.seed@kcl.ac.uk, paul.t.seed@gmail.com King's College London, Division of Reproduction and Endocrinology St Thomas' Hospital, Westminster Bridge Road, London SE1 7EH Alessandro A. Leidi wrote:

Dear Paul,Just to bring to your attention that I have hit a snag with your excellent Stata package -diagt- version 2.0.5, which does not like to be prefixed by-bootstrap-, since it calls -diagti- for computations, as explained by Thomas Steichen below.Tried but failed to locate an earlier version like 2.0.0: do you know where I can find one?Meanwhile I'll try to delve into diagt.ado and diagti.ado fo version 2.0.5 to see if I can contribute. Thank you and regards Sandro Leidi ________________________________________ From "Steichen, Thomas J." <SteichT@RJRT.com> To "'statalist@hsphsun2.harvard.edu'" <statalist@hsphsun2.harvard.edu> Subject st: RE: RE: bootstrap with a user-contributed command Date Mon, 11 May 2009 16:09:37 -0400 ________________________________________ Assuming you are running version 2.0.5 or later of -diagt-, the problem appears to be that -diagt- calls -diagti-, wherein r(spec) and r(sens) are generated, then -diagt- reads these values and attempts to repost them. The values appear to get lost when -bootstrap- is wrapped around everything. Version 2.0.0 of -diagt- does its own computations (i.e., doesn't call -diagti-), so it works fine with -bootstrap-: . diagti 80 17 11 44 True | disease | Test result status | Pos. Neg. | Total -----------+----------------------+---------- Abnormal | 80 17 | 97 Normal | 11 44 | 55 -----------+----------------------+---------- Total | 91 61 | 152 [95% Conf. Inter.] ------------------------------------------------------------------------- Sensitivity Pr( +| D) 82.47% 73.43% 89.45% Specificity Pr( -|~D) 80.00% 67.03% 89.57% Positive predictive value Pr( D| +) 87.91% 79.40% 93.81% Negative predictive value Pr(~D| -) 72.13% 59.17% 82.85% ------------------------------------------------------------------------- Prevalence Pr(D) 63.82% 55.64% 71.44% ------------------------------------------------------------------------- Likelihood Ratio of Pos. Test LR+ 4.12 2.41 7.05 Likelihood Ratio of Neg. Test LR- 0.22 0.14 0.34 ------------------------------------------------------------------------- . which diagt h:\ado\diagt.ado *! diagt 2.0.0 21 Feb 2001 PTS -- added DR and FPR . bootstrap sens=r(sens) spec=r(spec): diagt true test (running diagt on estimation sample) Warning: Since diagt is not an estimation command or does not set e(sample), bootstrap has no way to determine which observations are used in calculating the statistics and so assumes that all observations are used. This means no observations will be excluded from the resampling because of missing values or other reasons. If the assumption is not true, press Break, save the data, and drop the observations that are to be excluded. Be sure that the dataset in memory contains only the relevant data. Bootstrap replications (50) ----+--- 1 ---+--- 2 ---+--- 3 ---+--- 4 ---+--- 5 .................................................. 50 Bootstrap results Number of obs = 152 Replications = 50 command: diagt true test sens: r(sens) spec: r(spec) ------------------------------------------------------------------------------ | Observed Bootstrap Normal-based | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- sens | 82.47423 3.475202 23.73 0.000 75.66296 89.2855 spec | 80 4.271629 18.73 0.000 71.62776 88.37224 ------------------------------------------------------------------------------ ----------------------------------- Thomas J. Steichen steicht@rjrt.com ----------------------------------- -----Original Message----- From: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Alessandro A. Leidi Sent: Monday, May 11, 2009 1:13 PM To: statalist@hsphsun2.harvard.edu Subject: st: RE: bootstrap with a user-contributed command I had already tried bootstrapping -diagt- directly without a user-written program, see below. -bootstrap- squawks like it does when used with -rclass- functions but it does not deliver for -diagt-. Of course it may be my mistake, but where am I going wrong? Thank you for your consideration. Sandro Leidi a.a.leidi@rdg.ac.uk . quietly diagti 80 17 11 44 . which diagt c:\ado\plus\d\diagt.ado *! diagt 2.052, 30 June 2003 *! by PT Seed (paul.seed@kcl.ac.uk) *! based on diagtest.ado (Aurelio Tobias, STB-56: sbe36) *! and further suggestions from Tom Steichen . bootstrap sens=r(sens) spec=r(spec): diagt true test (running diagt on estimation sample) Warning: Since diagt is not an estimation command or does not set e(sample), bootstrap has no way to determine which observations are used in calculating the statistics and so assumes that all observations are used. This means no observations will be excluded from the resampling because of missing values or other reasons. If the assumption is not true, press Break, save the data, and drop the observations that are to be excluded. Be sure that the dataset in memory contains only the relevant data. Bootstrap replications (50) ----+--- 1 ---+--- 2 ---+--- 3 ---+--- 4 ---+--- 5 post __000002 not found post __000002 not found r(111); .

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

- Prev by Date:
**st: RE: RE: ifelse mata function** - Next by Date:
**st: re: ifelse mata function** - Previous by thread:
**st: ifelse mata function** - Next by thread:
**st: re: ifelse mata function** - Index(es):

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