Learn R Programming

Zelig (version 4.2-1)

rocplot: Receiver Operator Characteristic Plots

Description

The 'rocplot' command generates a receiver operator characteristic plot to compare the in-sample (default) or out-of-sample fit for two logit or probit regressions.

Usage

rocplot(y1, y2, fitted1, fitted2, cutoff = seq(from=0,
    to=1, length=100), lty1="solid", lty2="dashed",
    lwd1=par("lwd"), lwd2=par("lwd"), col1=par("col"),
    col2=par("col"), main="ROC Curve",
    xlab = "Proportion of 1's Correctly Predicted",
    ylab="Proportion of 0's Correctly Predicted",
    plot = TRUE, ... )

Arguments

y1
response variable for the first model
y2
response variable for the second model
fitted1
fitted values for the first model. These values may represent either the in-sample or out-of-sample fitted values
fitted2
fitted values for the second model
cutoff
A vector of cut-off values between 0 and 1, at which to evaluate the proportion of 0s and 1s correctly predicted by the first and second model. By default, this is 100 increments between 0 and 1 inclusive
lty1
the line type of the first model (defaults to 'line')
lty2
the line type of the second model (defaults to 'dashed')
lwd1
the line width of the first model (defaults to 1)
lwd2
the line width of the second model (defaults to 1)
col1
the color of the first model (defaults to 'black')
col2
the color of the second model (defaults to 'black')
main
a title for the plot (defaults to "ROC Curve")
xlab
a label for the X-axis
ylab
a lavel for the Y-axis
plot
whether to generate a plot to the selected device
...
additional parameters to be passed to the plot

Value

  • if plot is TRUE, rocplot simply generates a plot. Otherwise, a list with the following is produced:
  • roc1a matrix containing a vector of x-coordinates and y-coordinates corresponding to the number of ones and zeros correctly predicted for the first model.
  • roc2a matrix containing a vector of x-coordinates and y-coordinates corresponding to the number of ones and zeros correctly predicted for the second model.
  • area1the area under the first ROC curve, calculated using Reimann sums.
  • area2the area under the second ROC curve, calculated using Reimann sums.