Announcement

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

  • Graphical display of Max Youden index

    Dear Experts,
    I need your help to obtain a code to generate simmilar graph for graphical representation of the sensitivity, specificity, and the Youden index at different ratios. Simmilar to what is posted here
    How would it be possible to have the Youden index on the Y axis with the Ratio on the X axis and have a line that marks the highest Youden index area.
    I much appreciate your help
    Sincerely
    Click image for larger version

Name:	AAA.png
Views:	1
Size:	281.3 KB
ID:	1471366

  • #2
    So first, you need a command that outputs sensitivity and specificity, e.g., lsens after logit regression. Youden's J statistic (or Youden's index) is defined as \(\text{sensitivity}-(1-\text{specificity})\), and you can calculate this directly. Finally, you use twoway to graph, specifying two y-axes. Here is an example using Hosmer and Lemeshow's birth weight data.

    Code:
    *OPEN DATA SET AND RUN LOGIT REGRESSION
    webuse lbw, clear
    logit low age i.race
    
    *GENERATE CUTOFF, SENSITIVITY AND SPECIFICITY USING -LSENS- COMMAND  
    qui lsens, genprob(cutoff) gensens(sens) genspec(spec) nograph
    format cutoff sens spec %9.2f
    *CALCULATE YOUDEN INDEX
    gen youden= sens-(1-spec)
    
    *OBTAIN CUTOFF CORRESPONDING TO MAXIMUM OF YOUDEN INDEX
    sum youden
    sum cutoff if youden==r(max)
    local max= r(mean)
    
    *GRAPH (Constraining both y-axes to be equal)
    set scheme s1color
    twoway (connected sens spec cutoff, sort msymbol(S) msymbol(T) ///
    ylabel(0(.25)1, grid) ytitle("Sensitivity/Specificity") ///
    xlabel(0(.25)1, grid) xtitle("Probability cutoff") title("")) ///
    (connected youden cutoff, sort msymbol(O) yaxis(2) ylabel(0(.25)1, ///
    grid  axis(2)) ytitle("Youden Index", axis(2)) xline(`max', lcolor(black)))
    
    *GRAPH (Not constraining both y-axes to be equal)
    twoway (connected sens spec cutoff, sort msymbol(S) msymbol(T) ///
    ylabel(0(.25)1, grid) ytitle("Sensitivity/Specificity") ///
    xlabel(0(.25)1, grid) xtitle("Probability cutoff") title("")) ///
    (connected youden cutoff, sort msymbol(O) yaxis(2) ///
    ytitle("Youden Index", axis(2)) xline(`max', lcolor(black)))
    The resulting graphs are:

    1. Constraining both y-axes to be equal
    Click image for larger version

Name:	Graph.png
Views:	1
Size:	51.7 KB
ID:	1471428



    2. Not constraining both y-axes to be equal
    Click image for larger version

Name:	Graph2.png
Views:	1
Size:	56.3 KB
ID:	1471429

    Last edited by Andrew Musau; 21 Nov 2018, 08:09.

    Comment


    • #3
      Thats brilliant. Thanks a lot

      Comment

      Working...
      X