Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Sensitivity Specificity and PPV and NPV

    Hello there,

    I am using diagt command for the calculations of Sensitivity and Specificity of a 2x2 table. However, I am confused as when I run it, the values of a, b, c, and d displayed in the 2x2 table are different from those values displayed when using the command diagti a= 30 b= 32 c= 19 and d=193.

    the original 2x2 table is: a= 30 b= 32 c= 19 and d=193.

    when running:
    diagt Culture ResultLAM if (Culture==1 | Culture==2)

    the 2x2 appears as: a= 193, b=32, c=19 and d=30


    and when running:
    diagti 30 32 19 193

    the 2x2 table appears: a=193, b=19, c=32, and d=30


    Does it make sense, or I do not get it?
    Thank you.



  • #2
    Hi Juan,

    Welcome to the Statalist and providing some example code to help us understand your problem.

    I think your confusion comes from the way that the -diagt- command parameterizes the 2x2 classification table (and then labels its results). The guide to understanding this can be found in the command's documentation which you can access with -help diagt-. Reading this, it says

    #a #b #c #d are, respectively, the numbers of true positives (diseased subjects with correct positive test results), false negatives (disease, but negative test), false positives (no disease, but positive test) and true negatives (no disease, negative test).
    If we use some simple notation, we can say the same thing as above using a more common presentation format for the 2x2 table.

    Code:
                            Disease Status
                   | + (Diseased)  |  - (Healthy)  |
    ------------------------------------------------
    Test +         |       A       |       B       |
    (Diseased)     |      (TP)     |     (FP)      |
                   |  Pr(T+ | D+)  |  Pr(T+ | D-)  |
    ------------------------------------------------
    Test -         |       C       |       D       |
    (Not Diseased) |      (FN)     |      (TN)     |
                   |  Pr(T- | D+)  |  Pr(T- | D-)  |
    ------------------------------------------------
    Note the differences between what I have drawn, versus example output from -diagt-.

    Code:
    . diagti 80 17 11 44
    
          True |
       disease |      Test result
        status |      Neg.       Pos. |     Total
    -----------+----------------------+----------
        Normal |        44         11 |        55
      Abnormal |        17         80 |        97
    -----------+----------------------+----------
         Total |        61         91 |       152
    Two things are apparent. The first is that -diagt- places disease status in the rows, rather than its usual placement in the columns. The second is that positive and negative rows/columns are swapped. A simple transformation from the -diagt- format of the table is to transpose the table, then swap positions of the positive and negative rows/columns.

    Now I hope the two formats are made clear and you will see how to input data in the format that -diagt- expects.
    Last edited by Leonardo Guizzetti; 01 Sep 2018, 08:46. Reason: Completed the content of my post after accidental submission.

    Comment

    Working...
    X