Subscribe Bookmark RSS Feed

How do I display multiple ROC curves on the same graph?

Hello everyone,
I am trying to develop a test to distinguish between two groups (0 and 1). There are two tests A and B have different ROC curves which I have been able to plot individually. However I want to generate a graph that displays the ROC curves for A, B and A*B in the same panel. Can anyone help me with this?
3 REPLIES
I was wondering the same thing, anyone know the answer?
mpb

Super User

Joined:

Jun 23, 2011

One way is to make use of the ROC Table which exists after you choose to make the ROC plot. Basically, for each test make the ROC Table into a data table, concatenate them using the option to create a new column identifying the source tables, then use Overlay Plot with the plots grouped by source table and turning on Overlay by Groups. You can do this interactively or with something like the following example which I pieced together by saving scripts after doing it interactively:



dt = open("$SAMPLE_DATA/Fitness.jmp");

fm = dt << Fit Model(

    Y( :Sex ),

    Effects( :Oxy ),

    Personality( Nominal Logistic ),

    Run Model(

        Positive
Level( "M" ),

       
Likelihood Ratio Tests( 1 ),

        Wald
Tests( 0 ),

        ROC
Curve( 1 ),

        Logistic
Plot( 1 ),

       
SendToReport(

       
    Dispatch( {"Receiver Operating
Characteristic"}, "ROC Table", OutlineBox, Close( 0 ) )

        )

    )

);

fmReport = Report( fm );

fmReport["ROC Table"][Table Box( 1 )] << make into data
table;

data table(1)  << set name("Oxy");



fm = dt << Fit Model(

    Y( :Sex ),

    Effects( :Runtime ),

    Personality( Nominal Logistic ),

    Run Model(

        Positive
Level( "M" ),

       
Likelihood Ratio Tests( 1 ),

        Wald
Tests( 0 ),

        ROC
Curve( 1 ),

        Logistic
Plot( 1 ),

       
SendToReport(

       
    Dispatch( {"Receiver Operating
Characteristic"}, "ROC Table", OutlineBox, Close( 0 ) )

        )

    )

);

fmReport = Report( fm );

fmReport["ROC Table"][Table Box( 1 )] << make into data
table;

data table(1)  << set name("Runtime");



Concatenate(

    Data Table( "Runtime" ),

    Data Table( "Oxy" ),

    Output Table( "Both" ),

    Create source column

);



Overlay Plot(

    X( :Name( "1-Specificity" ) ),

    Y( :Sensitivity ),

    Grouping( :Source Table ),

    Overlay Groups,

    Step( 1 ),

    Show Points( 0 ),

    SendToReport(

        Dispatch(

       
    {},

       
    "106",

       
    ScaleBox( 2 ),

       
    {Format( "Best", 10 ), Show Major Grid(
1 )}

        ),

        Dispatch(
{}, "101", ScaleBox( 2 ), {Show Major Grid( 1 )} )

    )

);




style="margin-bottom: 0.0001pt; line-height: normal;">
style="font-size: 10pt; font-family: "Courier New"; color: navy;">

style="font-size: 10pt; font-family: "Courier New"; color: black;">

mpb

Super User

Joined:

Jun 23, 2011

Same thing using Fit Y by X platform and Make Combined Data Table:



dt = open("$SAMPLE_DATA/Fitness.jmp");

New Window( "Fitness- Fit Y by X of Sex",

    H List Box(

        LogOxy =
Logistic(

       
    Y( :Sex ),

       
    X( :Oxy ),

       
    Positive Level( "M" ),

       
    ROC Curve,

       
    SendToReport(

       
        Dispatch(

       
       
    {"Receiver Operating Characteristic"},

       
       
    "ROC Table",

       
       
    OutlineBox,

       
       
    Close( 0 )

       
        )

       
    )

        ),

       
LogRuntime = Logistic(

       
    Y( :Sex ),

       
    X( :Runtime ),

       
    Positive Level( "M" ),

       
    ROC Curve,

       
    SendToReport(

       
        Dispatch(

       
       
    {"Receiver Operating Characteristic"},

       
       
    "ROC Table",

       
       
    OutlineBox,

       
       
    Close( 0 )

       
        )

       
    )

        )

    )

);

Logrep = Report(LogOxy);

Logrep["ROC Table"][Table Box( 1 )] << make combined data
table;

data table(1) << set name("Both");



Overlay Plot(

    X( :Name( "1-Specificity" ) ),

    Y( :Sensitivity ),

    Grouping( :X ),

    Overlay Groups,

    Step( 1 ),

    Show Points( 0 ),

    SendToReport(

        Dispatch(

       
    {},

       
    "106",

       
    ScaleBox( 2 ),

       
    {Format( "Best", 10 ), Show Major Grid(
1 )}

        ),

        Dispatch(
{}, "101", ScaleBox( 2 ), {Show Major Grid( 1 )} )

    )

);