rra.test {iRRA}R Documentation

Comparing two ROC curves' RRA

Description

This function tests two ROC curves and check which one has the best RRA. It can get as input either two "rra_result" objects or two ROC curves based on the same data set (AN and AP values are the same for both curves)

Usage

rra.test(...)
## Default S3 method:
rra.test(roc_x_1, roc_y_1, roc_x_2, roc_y_2, AP, AN, ...)
## S3 method for class 'rra_result'
rra.test(rra_result_1, rra_result_2, plot = TRUE,
         col1 = "black", col2 = "red",
         cUnder1 = "light blue", cUnder2 = "yellow", lty1 = "dashed", ...)
## S3 method for class 'list'
rra.test(list1, list2 = c(), AP, AN, plot = TRUE, legend = FALSE,
         colBest = "black", lwdBest = 2, ltyBest = "solid",
         cUnderBest = "light blue", lwdOther = 1, ltyOther = "dashed",
         addcUnderOthers = FALSE, ...)

Arguments

roc_x_1

The x values of the first ROC curve's points

roc_y_1

The y values of the first ROC curve's points

roc_x_2

The x values of the second ROC curve's points

roc_y_2

The y values of the second ROC curve's points

AP

The number of actual positives. This value represents the number of positive responses (the "1" values) used to build the ROC curve. It must be greater than 0

AN

The number of actual negatives. This value represents the number of negative responses (the "0" values) used to build the ROC curve. It must be greater or equal to 0

rra_result_1

The first "rra_result" object to test

rra_result_2

The second "rra_result" object to test

plot

If the user wants to plot the two ROC curves and their RoIs

col1

The color of the first ROC curve when plotted

col2

The color of the second ROC curve when plotted

cUnder1

The color of the first RoI space under the curve

cUnder2

The color of the second RoI space under the curve

lty1

The style of the "worst" curve. It corresponds to lty of the plot.default function

list1

Either a list of "rra_result" object or a list of vectors containing the x values of the ROC curves

list2

A list of vectors containing the y values of the ROC curves. It's empty by default as it is not used if list1 is a list of "rra_result" object

legend

If the user wants to plot a legend of the drawn ROC curves

colBest

Line's color of the ROC curve with the best RRA value

lwdBest

Line's width of the ROC curve with the best RRA value

ltyBest

Line's style of the ROC curve with the best RRA value

cUnderBest

Color of the RoI under the curve with the best RRA value

lwdOther

Line's width of the other ROC curves

ltyOther

Line's style of the other ROC curves

addcUnderOthers

If the user wants to draw the RoI under the other curves

...

Other parameters that can be set.

Especially:

  • For the default method all the parameters for rra and the method for class "rra_result"

  • For the method for class "rra_result" the parameters for rra.plot to modify the appearance of the ROC curve

  • For the method for class "list" all the parameters for rra and for rra.plot (except for col, lwd, lty and cUnder, more informations in the Details section)

Details

It is possible to plot the two ROC curves and their RoIs.

The method for class "list" will return a vector of the indices of the parameters' list ordered by their RRA values.

It's possible to test any "rra_result" object, but when two curves are generated by different data sets (AN and AP values have different values for the two curves), or when the RoI is computed by different performance metrics, the user will be warned.

rra.plot parameters col, lwd, lty and cUnder are overwritten by colBest, lwdBest, ltyBest and cUnderBest in the method for class "list". It is possible to use both but it will give an error if used at the same time.

The color of the other curves in rra.test.list is randomly selected by a list of colors.

By default the RoI under the curve of the other curves will not be drawn to make the plot easier to understand. Consider that, if the "rra_result" object considered have different RoI and RoI under the curve (diferent data-set or different reference metrics), one may want to set AddcUnderOthers=TRUE

See Also

rra, rra.plot

Examples

## Not run: 
# Considering rra_result_1 <- rra(roc_x, roc_y, AP, AN, phi = TRUE, fallout = 0.5),
# and rra_result_2 <- rra(roc2_x, roc2_y, AP, AN, phi = TRUE, fallout = 0.5)
# (both ROC curves made from the same data set)
# If we consider the rra_result_2 better than the other,
rra.test(rra_result_1, rra_result_2, colUnder1 = "green", col1 = "purple")
> The second ROC curve (red) has a better RRA value than the first one (purple)

rra.test(roc$x, roc$y, roc2$x, roc2$y, AP, AN, phi = TRUE,
         fallout = TRUE, c_fallout = 0.5)
> The second ROC curve (red) has a better RRA value than the first one (black)

# Considering rra_result_1 <- rra(roc_x_1, roc_y_1, AP, AN, fallout = TRUE,
                                 c_fallout = 0.6,
                                 j = TRUE, c_j = 0.35,
                                 phi = TRUE),
#and rra_result_2 <- rra(roc_x_2, roc_y_2, AP, AN, npv = TRUE,
                         markedness = TRUE, c_markedness = 0.4),
#
rra.test(rra_result_1, rra_result_2)
> The second ROC curve (red) has a better RRA value than the first one (black)
> Warning message:
> In rra.test.rra_result(rra_result_1, rra_result_2) :
>   The Regions of Interest considered have been made by
>   different performance metrics or different metrics' values as references

## End(Not run)

[Package iRRA version 0.1.0 Index]