Announcement

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

  • grey-zone model with STATA

    Dear all,

    Does anyone know the command to find two cutoffs for a marker by fitting a grey-zone model that will define high, intermediate, and low risk groups when the outcome is binary ?

    It is equivalent to "greyzone.funcs" in R software.

    Thank you for your help

    Best regards

    Cyril

  • #2
    For the benefit of others, the same basic question was posted to ResearchGate a few days ago.

    Cyril, here's what you wrote in one of those RG posts:

    I want to propose an algorithm helping to distinguish patients with or without ischemia. I previously used a marker (Procalcitonin, PCT) to do so. My aim is to calculate PCT thresholds to obtain 3 populations :

    - the first for which PCT<threshold 1 : so the diagnosis of ischemia is negative

    - the second for which threshold 1 < PCT < threshold 2 : the diagnosis is uncertain and we should add another marker

    - the third for which PCT > threshold 2 : so the diagnosis is positive
    I think what you're saying is that you want one cut-point that yields very good specificity, and another that yields very good sensitivity. But you've not said that exactly. And if that is what you want to do, you've not said what the desired levels of sensitivity and specificity are.

    HTH.
    --
    Bruce Weaver
    Email: [email protected]
    Version: Stata/MP 18.5 (Windows)

    Comment


    • #3
      Dear Bruce

      Thank you for your answer.

      You're right : I want one cut-point with very good specificity (>90%), and another with very good sensitivity (>90%)

      Best regards

      Comment


      • #4
        Something like this, then?

        Code:
        clear *
        sysuse auto
        * Treat foreign as 'disease' and mpg as quantitative 'marker'
        roctab foreign mpg, graph table detail
        
        generate byte cut1 = mpg >= 17 // Ensure sens >= 90%
        generate byte cut2 = mpg >= 28 // Ensure spec >= 90%
        tabulate cut1 foreign, col
        tabulate cut2 foreign, col
        
        generate byte testval = 1 if !cut1
        replace testval = 2 if cut1 & !cut2
        replace testval = 3 if cut2
        label define testlabs 1 "Domestic" 2 "Uncertain" 3 "Foreign"
        label values testval testlabs
        tabulate testval foreign, row col
        Output from the final -tabulate- command:
        Code:
        . tabulate testval foreign, row col
        
        +-------------------+
        | Key               |
        |-------------------|
        |     frequency     |
        |  row percentage   |
        | column percentage |
        +-------------------+
        
                   |       Car type
           testval |  Domestic    Foreign |     Total
        -----------+----------------------+----------
          Domestic |        13          1 |        14
                   |     92.86       7.14 |    100.00
                   |     25.00       4.55 |     18.92
        -----------+----------------------+----------
         Uncertain |        34         15 |        49
                   |     69.39      30.61 |    100.00
                   |     65.38      68.18 |     66.22
        -----------+----------------------+----------
           Foreign |         5          6 |        11
                   |     45.45      54.55 |    100.00
                   |      9.62      27.27 |     14.86
        -----------+----------------------+----------
             Total |        52         22 |        74
                   |     70.27      29.73 |    100.00
                   |    100.00     100.00 |    100.00

        Using these cut-points, 4.55% of foreign cars would be misidentified as domestic, and 9.62% of domestic cars would be misidentified as foreign.

        As you can see above, I hard-coded the cut-off values (17 and 28) when generating cut1 and cut2. If this is a one-time task, hard-coding the values may suffice. If it is not a one-time task, there is likely a way to grab those values from post-estimation info. Or maybe someone knows of a program that does all of this more efficiently.

        HTH.
        --
        Bruce Weaver
        Email: [email protected]
        Version: Stata/MP 18.5 (Windows)

        Comment


        • #5
          Thank you Bruce for your help

          Best regards

          Cyril

          Comment

          Working...
          X