Statalist


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

st: RE: -senspec- interpretation question


From   "Newson, Roger B" <r.newson@imperial.ac.uk>
To   "'statalist@hsphsun2.harvard.edu'" <statalist@hsphsun2.harvard.edu>
Subject   st: RE: -senspec- interpretation question
Date   Tue, 10 Nov 2009 22:29:23 +0000

I have cut and pasted Michael's program, and have run it. It seems to run OK, but I am not clear what Michael's query is.

If I run Michael's program, and then type, in Stata,

tab test disease if method==1, row

then the result is:

**** BEGINNING OF Stata LOG - CUT HERE
+----------------+
| Key            |
|----------------|
|   frequency    |
| row percentage |
+----------------+

           |        disease
      test |         0          1 |     Total
-----------+----------------------+----------
         0 |        46        121 |       167 
           |     27.54      72.46 |    100.00 
-----------+----------------------+----------
         1 |       212        128 |       340 
           |     62.35      37.65 |    100.00 
-----------+----------------------+----------
     Total |       258        249 |       507 
           |     50.89      49.11 |    100.00 
**** END OF Stata LOG - CUT HERE

And, if I then type in Stata

xcontract test disease ntneg spec nfneg fneg nfpos fpos ntpos sens if method==1, list(, sepby(test))

then (as I have the SSC package -xcontract- installed) the result is:

**** BEGINNING OF Stata LOG - CUT HERE
Listing of results:

     +-------------------------------------------------------------------------------------------------------------------+
     | test   disease   ntneg        spec   nfneg        fneg   nfpos        fpos   ntpos        sens   _freq   _percent |
     |-------------------------------------------------------------------------------------------------------------------|
  1. |    0         0       0           0       0           0     258           1     249           1      46       9.07 |
  2. |    0         1       0           0       0           0     258           1     249           1     121      23.87 |
     |-------------------------------------------------------------------------------------------------------------------|
  3. |    1         0      46   .17829457     121   .48594378     212   .82170543     128   .51405622     212      41.81 |
  4. |    1         1      46   .17829457     121   .48594378     212   .82170543     128   .51405622     128      25.25 |
     +-------------------------------------------------------------------------------------------------------------------+
**** END OF Stata LOG - CUT HERE

The frequencies (_freq) given by the -xcontract- command are the same as the table cell numbers. And the sensitivities, specificities, false positive rates and true positive rates are equal, at each value of -test-, to those that would be observed if that value of -test- was the threshold value, and if a result is considered positive if and only if the test result is at OR above that value. (As specified by -help senspec- under the -posif()- option.) So what exactly is your query



Roger B Newson BSc MSc DPhil
Lecturer in Medical Statistics
Respiratory Epidemiology and Public Health Group
National Heart and Lung Institute
Imperial College London
Royal Brompton Campus
Room 33, Emmanuel Kaye Building
1B Manresa Road
London SW3 6LR
UNITED KINGDOM
Tel: +44 (0)20 7352 8121 ext 3381
Fax: +44 (0)20 7351 8322
Email: r.newson@imperial.ac.uk 
Web page: http://www.imperial.ac.uk/nhli/r.newson/
Departmental Web page:
http://www1.imperial.ac.uk/medicine/about/divisions/nhli/respiration/popgenetics/reph/

Opinions expressed are those of the author, not of the institution.

-----Original Message-----
From: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Michael McCulloch
Sent: 10 November 2009 20:46
To: Statalist Statalist
Subject: st: -senspec- interpretation question

Dear Statalist folks,
I'd like to ask advice on interpreting the output of -senspec-. I've  
created the following simple simulation example which allows me to  
compare the -senspec- output to a simple 2x2 table. The following code  
shows that the absolute numbers from -senspec- agrees with each cell  
of my 2x2 table, but the frequency values are different. Am I  
misinterpreting or mis-applying -senspec-?

clear
set obs 1000
set seed 12358	
gen test=1 + int(2*uniform())	
replace test=0 if test==2
replace test=1 in 1/300		
gen disease=0 in 1/500
replace disease=1 in 501/1000
tab test disease, row
gen method=1 + int(2*uniform())	
bysort method: tab test disease, row
tab test disease if method==1, row
senspec disease test if method==1, se(sens) spe(spec) fpos(fpos)  
ntneg(ntneg) fneg(fneg) ntpos(ntpos) nfpos(nfpos) nfneg(nfneg)
* cellA: ntneg sp  	cellB: nfneg fneg  	cellC: nfpos fpos  	cellD:  
ntpos se
list test disease ntneg spec nfneg fneg nfpos fpos ntpos sens in 1/10



Thank you kindly.



Michael McCulloch
Pine Street Foundation
124 Pine Street
San Anselmo, CA 94960-2674
tel:	415-407-1357
fax: 	206-338-2391
mm@pinestreetfoundation.org






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

*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index