Statalist


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

st: RE: RE: RE: bootstrap with a user-contributed command


From   "Lachenbruch, Peter" <[email protected]>
To   <[email protected]>
Subject   st: RE: RE: RE: bootstrap with a user-contributed command
Date   Mon, 11 May 2009 13:17:50 -0700

Looking at this, I was wondering if roctab might be of help here.

On a related point, unless the data are a random sample of a population,
the PPV and NPV may not have much relevance:  what does a PPV mean when
50% of the training sample is from the diseased group and in reality it
should be 1% or less?  The adjustment is simple, but most people aren't
aware of it.

Tony

Peter A. Lachenbruch
Department of Public Health
Oregon State University
Corvallis, OR 97330
Phone: 541-737-3832
FAX: 541-737-4001


-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Steichen,
Thomas J.
Sent: Monday, May 11, 2009 1:10 PM
To: '[email protected]'
Subject: st: RE: RE: bootstrap with a user-contributed command

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

. bootstrap sens=r(sens) spec=r(spec), reps(1000): 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 (1000)
----+--- 1 ---+--- 2 ---+--- 3 ---+--- 4 ---+--- 5
..................................................    50
..................................................   100
..................................................   150
..................................................   200
..................................................   250
..................................................   300
..................................................   350
..................................................   400
..................................................   450
..................................................   500
..................................................   550
..................................................   600
..................................................   650
..................................................   700
..................................................   750
..................................................   800
..................................................   850
..................................................   900
..................................................   950
..................................................  1000

Bootstrap results                               Number of obs      =
152
                                                Replications       =
1000

      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.88919    21.21   0.000     74.85155
90.0969
        spec |         80   5.674551    14.10   0.000     68.87808
91.12192
------------------------------------------------------------------------
------



-----------------------------------
Thomas J. Steichen
[email protected]
-----------------------------------

-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Alessandro A.
Leidi
Sent: Monday, May 11, 2009 1:13 PM
To: [email protected]
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
[email protected]

. quietly diagti 80 17 11 44

. desc

Contains data
  obs:           152
 vars:             2
 size:           912 (99.9% of memory free)
------------------------------------------------------------------------
---------------------------------------              storage  display
value
variable name   type   format      label      variable label
------------------------------------------------------------------------
---------------------------------------true            byte   %8.0g
true       True disease status
test            byte   %8.0g       test       Test result
------------------------------------------------------------------------
---------------------------------------Sorted by:
     Note:  dataset has changed since last saved

. 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);

.

st: RE: bootstrap with a user-contributed command

------------------------------------------------------------------------
--------



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