Announcement

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

  • Confidence Interval for Sensitivity and Specificity

    I have the following data and would like to calculate the confidence interval for the sensitivity and specificity.
    I used the tab command and col option to get the sensitivity and specificity but I will need the CI also.
    Can anyone help?
    The reference test is scores and the other test is f145.
    Thanks
    ----------------------- copy starting from the next line -----------------------
    Code:
    * Example generated by -dataex-. To install: ssc install dataex
    clear
    input byte scores str7 f145
    0 "0"
    0 "0"
    0 "0"
    1 "1"
    0 "0"
    0 "0"
    0 "0"
    0 "0"
    0 "1"
    0 "0"
    0 "0"
    end
    ------------------ copy up to and including the previous line ------------------

    Listed 11 out of 114 observations

  • #2
    I found this here: https://www.stata.com/statalist/arch.../msg00779.html
    If this ado does not help you one could also think about bootstrapping.
    Best wishes

    (Stata 16.1 MP)

    Comment


    • #3
      diagt (SSC) will provide what you seek (and more):

      Code:
      clear
      input byte scores str7 f145
      0 "0"
      0 "0"
      0 "0"
      1 "1"
      0 "0"
      0 "0"
      0 "0"
      0 "0"
      0 "1"
      0 "0"
      0 "0"
      end
      
      // we need numeric variables
      destring f145 , generate(testvar)
      
      diagt score testvar
      yields

      Code:
      . diagt score testvar
      
                 |        testvar
          scores |      Pos.       Neg. |     Total
      -----------+----------------------+----------
        Abnormal |         1          0 |         1 
          Normal |         1          9 |        10 
      -----------+----------------------+----------
           Total |         2          9 |        11 
      True abnormal diagnosis defined as scores = 1
      
      
                                                        [95% Confidence Interval]
      ---------------------------------------------------------------------------
      Prevalence                         Pr(A)      9.1%      0.2%      41.3%
      ---------------------------------------------------------------------------
      Sensitivity                      Pr(+|A)    100.0%      2.5%    100.0%
      Specificity                      Pr(-|N)     90.0%     55.5%     99.7%
      ROC area               (Sens. + Spec.)/2      0.95         .      1.00 
      ---------------------------------------------------------------------------
      Likelihood ratio (+)     Pr(+|A)/Pr(+|N)     10.00      1.56     64.20 
      Likelihood ratio (-)     Pr(-|A)/Pr(-|N)      0.00         .         . 
      Odds ratio                   LR(+)/LR(-)         .      0.00         . 
      Positive predictive value        Pr(A|+)     50.0%      1.3%     98.7% 
      Negative predictive value        Pr(N|-)    100.0%     66.4%    100.0% 
      ---------------------------------------------------------------------------
      
        Missing values or confidence intervals may be estimated
        using the -sf- or -sf0- options.

      Also, see

      Code:
      help ci

      Comment


      • #4
        Thanks a lot Daniel Klein.

        This was very helpful. So happy with the information. Just solved my problem!!!!!

        Thanks again.

        Comment

        Working...
        X