- const struct roc_chart *rc = UP_CAST (chart, struct roc_chart, chart);
- size_t i;
-
- chart_write_title (cr, geom, _("ROC Curve"));
- chart_write_xlabel (cr, geom, _("1 - Specificity"));
- chart_write_ylabel (cr, geom, _("Sensitivity"));
-
- chart_write_xscale (cr, geom, 0, 1, 5);
- chart_write_yscale (cr, geom, 0, 1, 5);
-
- if ( rc->reference )
- {
- chart_line (cr, geom, 1.0, 0,
- 0.0, 1.0,
- CHART_DIM_X);
- }
-
- for (i = 0; i < rc->n_vars; ++i)
- {
- const struct roc_var *rv = &rc->vars[i];
- struct casereader *r = casereader_clone (rv->cutpoint_reader);
- struct ccase *cc;
-
- chart_vector_start (cr, geom, rv->name);
- for (; (cc = casereader_read (r)) != NULL; case_unref (cc))
- {
- double se = case_data_idx (cc, ROC_TP)->f;
- double sp = case_data_idx (cc, ROC_TN)->f;
-
- se /= case_data_idx (cc, ROC_FN)->f + case_data_idx (cc, ROC_TP)->f ;
- sp /= case_data_idx (cc, ROC_TN)->f + case_data_idx (cc, ROC_FP)->f ;
-
- chart_vector (cr, geom, 1 - sp, se);
- }
- chart_vector_end (cr, geom);
- casereader_destroy (r);
- }
-
- chart_write_legend (cr, geom);
-}
-
-static void
-roc_chart_destroy (struct chart *chart)
-{
- struct roc_chart *rc = UP_CAST (chart, struct roc_chart, chart);