Help Constructing ROC curve

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Help Constructing ROC curve

Eric Benchimol
Hello!
I am having trouble constructing an ROC and getting Area under the ROC curve in SPSS.  I'm hoping someone can help me.

I have a test that consists of ordinal data (1/8 codes, 2/8
codes, 3/8 codes, etc.)  I want to see how many codes accurately
diagnoses a disease.

When
I graph the sensitivies vs (1-specificities) in Prism and SAS, I get a
nice ROC curve, with AUROC 0.9618 (by Prism) and I can figure out the
cutoff.  But, SPSS doesn't seem to graph it properly either when I make
a dataset with raw numbers - I manually created a dataset with columns of:
1) # of codes
2) Disease +/- (1/0)

I deleted all tests that were negative (since ROC curves only
consist of TP and FP patients).  When I run the ROC Curve in SPSS, it
gives me a poor ROC with an AUROC of 0.68 - not at all what I get when
I graph the ROC manually.

Any thoughts as to how I would set up my dataset to get the correct ROC?

Here is an example of my 2x2 tables:

1/8 codes:
Disease+/Test+ = 323
Disease+/Test- = 3
Disease-/Test+ = 91
Disease-/Test- = 102
Sens 99.08
Spec 52.85
PPV 78.02
NPV 97.14

2/8 codes:
Disease+/Test+ = 322
Disease+/Test- = 4
Disease-/Test+ = 69
Disease-/Test- = 124
Sens 98.77
Spec 64.25

3/8 codes:
Disease+/Test+ = 318
Disease+/Test- = 8
Disease-/Test+ = 47
Disease-/Test- = 146
Sens 97.55
Spec 75.65

4/8 codes:
Disease+/Test+ = 313
Disease+/Test- = 13
Disease-/Test+ = 37
Disease-/Test- = 156
Sens 96.01
Spec 80.83

etc etc. etc. through 5/8, 6/8, 7/8, 8/8

Thank you in advance!!

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD
Reply | Threaded
Open this post in threaded view
|

Re: Help Constructing ROC curve

Marta Garcia-Granero
Hi Eric

> Hello!
> I am having trouble constructing an ROC and getting Area under the ROC curve in SPSS.  I'm hoping someone can help me.
>
> I have a test that consists of ordinal data (1/8 codes, 2/8
> codes, 3/8 codes, etc.)  I want to see how many codes accurately
> diagnoses a disease.
>
> When
> I graph the sensitivies vs (1-specificities) in Prism and SAS, I get a
> nice ROC curve, with AUROC 0.9618 (by Prism) and I can figure out the
> cutoff.  But, SPSS doesn't seem to graph it properly either when I make
> a dataset with raw numbers - I manually created a dataset with columns of:
> 1) # of codes
> 2) Disease +/- (1/0)
>
I don't fully understand your explanation, but here's my guess: You have
to use raw data:
You need 3 variables:

CodeValue (ranging from 1 to 8)
Disease +/- (1/0)
Frequency of  codes.

Weight the dataset by Frequency and run ROC.

HTH,
Marta

> I deleted all tests that were negative (since ROC curves only
> consist of TP and FP patients).  When I run the ROC Curve in SPSS, it
> gives me a poor ROC with an AUROC of 0.68 - not at all what I get when
> I graph the ROC manually.
>
> Any thoughts as to how I would set up my dataset to get the correct ROC?
>
> Here is an example of my 2x2 tables:
>
> 1/8 codes:
> Disease+/Test+ = 323
> Disease+/Test- = 3
> Disease-/Test+ = 91
> Disease-/Test- = 102
> Sens 99.08
> Spec 52.85
> PPV 78.02
> NPV 97.14
>
> 2/8 codes:
> Disease+/Test+ = 322
> Disease+/Test- = 4
> Disease-/Test+ = 69
> Disease-/Test- = 124
> Sens 98.77
> Spec 64.25
>
> 3/8 codes:
> Disease+/Test+ = 318
> Disease+/Test- = 8
> Disease-/Test+ = 47
> Disease-/Test- = 146
> Sens 97.55
> Spec 75.65
>
> 4/8 codes:
> Disease+/Test+ = 313
> Disease+/Test- = 13
> Disease-/Test+ = 37
> Disease-/Test- = 156
> Sens 96.01
> Spec 80.83
>
> etc etc. etc. through 5/8, 6/8, 7/8, 8/8
>
> Thank you in advance!!
>
> =====================
> To manage your subscription to SPSSX-L, send a message to
> [hidden email] (not to SPSSX-L), with no body text except the
> command. To leave the list, send the command
> SIGNOFF SPSSX-L
> For a list of commands to manage subscriptions, send the command
> INFO REFCARD
>
>


--
For miscellaneous statistical stuff, visit:
http://gjyp.nl/marta/

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD
Reply | Threaded
Open this post in threaded view
|

Re: Help Constructing ROC curve

Marta Garcia-Granero
In reply to this post by Eric Benchimol
Hi Eric

 From your cumulant 2x2 tables, I think I have an idea about how your
data  look. This is a smple of your data, as you would need them in
order to get the ROC curve (since you did not give all data, I have not
been able to write the whole dataset)  :

DATA LIST LIST/Disease    Code    Frequency (3 F8).
BEGIN DATA
1    1    3
0    1    102
1    2    1
0    2    22
1    3    4
0    3    22
1    4    5
0    4    10
1    5    .
0    5    .
1    6    .
0    6    .
1    7    .
0    7    .
1    8    .
0    8    .
END DATA.
WEIGHT BY Frequency.

ROC.........


> I am having trouble constructing an ROC and getting Area under the ROC curve in SPSS.  I'm hoping someone can help me.
>
> I have a test that consists of ordinal data (1/8 codes, 2/8
> codes, 3/8 codes, etc.)  I want to see how many codes accurately
> diagnoses a disease.
>
> [....]
>
> Any thoughts as to how I would set up my dataset to get the correct ROC?
>
> Here is an example of my 2x2 tables:
>
> 1/8 codes:
> Disease+/Test+ = 323
> Disease+/Test- = 3
> Disease-/Test+ = 91
> Disease-/Test- = 102
> Sens 99.08
> Spec 52.85
> PPV 78.02
> NPV 97.14
>
> 2/8 codes:
> Disease+/Test+ = 322
> Disease+/Test- = 4
> Disease-/Test+ = 69
> Disease-/Test- = 124
> Sens 98.77
> Spec 64.25
>
> 3/8 codes:
> Disease+/Test+ = 318
> Disease+/Test- = 8
> Disease-/Test+ = 47
> Disease-/Test- = 146
> Sens 97.55
> Spec 75.65
>
> 4/8 codes:
> Disease+/Test+ = 313
> Disease+/Test- = 13
> Disease-/Test+ = 37
> Disease-/Test- = 156
> Sens 96.01
> Spec 80.83
>
> etc etc. etc. through 5/8, 6/8, 7/8, 8/8
>
> Thank you in advance!!
>
> =====================
> To manage your subscription to SPSSX-L, send a message to
> [hidden email] (not to SPSSX-L), with no body text except the
> command. To leave the list, send the command
> SIGNOFF SPSSX-L
> For a list of commands to manage subscriptions, send the command
> INFO REFCARD
>
>


--
For miscellaneous statistical stuff, visit:
http://gjyp.nl/marta/

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD