rocplot                package:Zelig                R Documentation

_R_e_c_e_i_v_e_r _O_p_e_r_a_t_o_r _C_h_a_r_a_c_t_e_r_i_s_t_i_c _P_l_o_t_s

_D_e_s_c_r_i_p_t_i_o_n:

     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.

_U_s_a_g_e:

     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, xlab, ylab,
             plot = TRUE, ...)

_A_r_g_u_m_e_n_t_s:

      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, lty2: The line type for the first model ('lty1') and the second
          model ('lty2'), defaulting to solid and dashed, respectively.

lwd1, lwd2: The width of the line for the first model ('lwd1') and the
          second model ('lwd2'), defaulting to 1 for both.

col1, col2: The colors of the line for the first model ('col1') and the
          second model ('col2'), defaulting to black for both.

    main: a title for the plot.  Defaults to 'ROC Curve'.

    xlab: a label for the x-axis.  Defaults to 'Proportion of 1's 
          Correctly Predicted'.

    ylab: a label for the y-axis.  Defaults to 'Proportion of 0's 
          Correctly Predicted'.

    plot: defaults to 'TRUE', which generates a plot to the selected
          device.  If 'FALSE', returns a list of items (see below).

     ...: Additional parameters passed to plot, including 'xlab',
          'ylab', and 'main'.  

_V_a_l_u_e:

     If 'plot = TRUE', 'rocplot' generates an ROC plot for two logit or
     probit models.  If 'plot = FALSE', 'rocplot' returns a list with
     the following elements: 

    roc1: a matrix containing a vector of x-coordinates and
          y-coordinates corresponding to the number of ones and zeros
          correctly predicted for the first model.

    roc2: a matrix containing a vector of x-coordinates and
          y-coordinates corresponding to the number of ones and zeros
          correctly predicted for the second model.

   area1: the area under the first ROC curve, calculated using Reimann
          sums.

   area2: the area under the second ROC curve, calculated using Reimann
          sums.

_A_u_t_h_o_r(_s):

     Kosuke Imai <kimai@princeton.edu>; Gary King <king@harvard.edu>;
     Olivia Lau <olau@fas.harvard.edu>

_S_e_e _A_l_s_o:

     The full Zelig manual (available at <URL:
     http://gking.harvard.edu/zelig>), 'plot', 'lines'.

_E_x_a_m_p_l_e_s:

     data(turnout)
     z.out1 <- zelig(vote ~ race + educate + age, model = "logit", 
       data = turnout)
     z.out2 <- zelig(vote ~ race + educate, model = "logit", 
       data = turnout)
     rocplot(z.out1$y, z.out2$y, fitted(z.out1), fitted(z.out2))

