Announcement

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

  • Diagnostic test using "roctab" command

    Dear All,
    Sub: Need a stata codes for sensitivity and specificity.
    I need to do the diagnostic test, where i need to calculate the sensitivity and specificity
    But condition applied "sensitivity at 80% specificity"
    So please help me out, how i can fix the specificity at 80% using "roctab" command

    Thanks in advance
    Divya

  • #2
    You don't say what kind of data you have to work with, so it is hard to give specific advice. I'll assume that you have a data set that includes both the diagnostic test result and the actual condition, both being coded as 0/1 variables. Let's call them test_result and truth, respectively.

    Code:
     roctab truth test_result, spec xline(0.8)
    will give you a graph of sensitivity vs specificity and you can read the value of sensitivity on the vertical axis where the vertical red line intersects the graph. Note that there may not actually be any point in the data where the specificity is exactly 80%.

    Since I think there are problems with reading numbers of graphs, another approach, not using -roctab- is:

    Code:
    logistic truth test_result
    lsens, gensens(sensitivity) genspec(specificity)
    If you then -list- or -browse- the data set you will see new variables near the top of the data set showing sensitivity and the corresponding values of specificity at all the possible cutpoints in the data set. Now, if one of them has specificity exactly equal to 0.80, you have your answer. If not, you might consider interpolating between the nearest specifcities above and below 0.80 or something like that.

    Comment


    • #3
      Thanks a lot Mr.Clyde. Let me try out the code .
      In my data, one variables is binary(0/1) and other variable is continuous.
      Hope i clarified the data structure.


      Thanks
      Divya

      Comment


      • #4
        OK. The "truth" variable has to be 0/1, but the test result can be continuous.

        Comment


        • #5
          Dear All,

          I have one more question related to this ROC curve.
          In my dataset both "truth" and "test_results" are binary (yes/no) . There is no continuous variable at all.
          With this information, can we draw a ROC curve?
          Is that possible, i am not sure.
          Please help me out

          Thanks in advance


          WR,
          Divya

          Comment

          Working...
          X