Announcement

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

  • Bootstrap to calculate IC95% of sensitivity, specificity and likelihood ratios

    Hi everyone,
    First I must precise I only have limited experience of STATA, I am a medical student. For example, I don't how to do programs in STATA.

    I have some difficulties to calculate IC95% of diagnostic performances (sensitivity, specificity and likelihood ratios) in my study.
    I study the performances of a sanguine marker to diagnose a fungal infection in HIV patients.
    I calculated these performances using the command "tab" and the option "col". For the likelihood ratio, I simply used the formula (Se/1-Sp for the positive LR, for example).

    I have 2 problems :
    1) My effectives are quite low, so I am not sure I can use classical formulas (which suppose that my variable is normally distributed) of 1.96*square(Se*(1-Se)/n)
    2) I have a sensitivity of 100%, and so I cannot calculate the IC95%.

    Here are an example of the data :
    Fungal infection No fungal infection
    Positive marker 20 24
    Negative marker 0 7
    Using the command :

    tab bdg_quali_80 malade1, col

    I was able to obtain sensitivity and specificity.
    However, I don't know how to use the bootstrap command now to obtain 95%CI.

    Thanks for your help, I hope my message is clear!

  • #2
    Code:
    * Example generated by -dataex-. For more info, type help dataex
    clear
    input byte(bdg_quali_80 malade1)
    1 1
    1 1
    1 1
    1 1
    1 1
    1 1
    1 1
    1 1
    1 1
    1 1
    1 1
    1 1
    1 1
    1 1
    1 1
    1 1
    1 1
    1 1
    1 1
    1 1
    1 0
    1 0
    1 0
    1 0
    1 0
    1 0
    1 0
    1 0
    1 0
    1 0
    1 0
    1 0
    1 0
    1 0
    1 0
    1 0
    1 0
    1 0
    1 0
    1 0
    1 0
    1 0
    1 0
    1 0
    0 0
    0 0
    0 0
    0 0
    0 0
    0 0
    0 0
    end
    label values bdg_quali_80 bdg_quali_80
    label def bdg_quali_80 0 "Negative Marker", modify
    label def bdg_quali_80 1 "Positive Marker", modify
    label values malade1 malade1
    label def malade1 0 "No fungal infection", modify
    label def malade1 1 "Fungal infection", modify
    
    tab bdg_quali_80 malade1, col
    
    capture program drop operating_characteristics
    program define operating_characteristics, rclass
        summ bdg_quali_80 if malade1, meanonly
        local sensitivity = r(mean)
        summ bdg_quali_80 if !malade1, meanonly
        local specificity = 1 - r(mean)
        return scalar sensitivity = `sensitivity'
        return scalar specificity = `specificity'
        return scalar likelihood_ratio = `sensitivity'/(1-`specificity')
        exit
    end
    
    bootstrap sens = r(sensitivity) spec = r(specificity) lr = r(likelihood_ratio), ///
        reps(500): operating_characteristics
    Note: Because the observed sensitivity is 1 in this data, bootstrapping does not get you a standard error. You can do better using the -ci proportion- command, which offers you a variety of approaches to confidence intervals for binomial proportions. See -help ci- for details.

    In the future, when showing data examples, please use the -dataex- command to do so, as I have here. If you are running version 17, 16 or a fully updated version 15.1 or 14.2, -dataex- is already part of your official Stata installation. If not, run -ssc install dataex- to get it. Either way, run -help dataex- to read the simple instructions for using it. -dataex- will save you time; it is easier and quicker than typing out tables. It includes complete information about aspects of the data that are often critical to answering your question but cannot be seen from tabular displays or screenshots. It also makes it possible for those who want to help you to create a faithful representation of your example to try out their code, which in turn makes it more likely that their answer will actually work in your data.

    Comment


    • #3
      I am struggling with the same bootstrap issue in STATA. Thank you Dr Schechter for this code, it works fine for me. However I need the 95% CI for the PPV and the NPV as well. Could you or another user please guide me how to do this? I would be very grateful for help.

      Comment

      Working...
      X