qpPrecisionRecall          package:qpgraph          R Documentation

_C_a_l_c_u_l_a_t_i_o_n _o_f _p_r_e_c_i_s_i_o_n-_r_e_c_a_l_l _c_u_r_v_e_s

_D_e_s_c_r_i_p_t_i_o_n:

     Calculates the precision-recall curve (see Fawcett, 2006) for a
     given measure of association between all pairs of variables in a
     matrix.

_U_s_a_g_e:

     qpPrecisionRecall(measurementsMatrix, refI, decreasing=TRUE, pairup.i=NULL,
                       pairup.j=NULL, recallSteps=c(seq(0,0.1,0.005),seq(0.2,1.0,0.1)))

_A_r_g_u_m_e_n_t_s:

measurementsMatrix: matrix containing the measure of association
          between all pairs of variables.

    refI: incidence matrix of reference from which to calculate the
          precision-recall curve.

decreasing: logical; if TRUE then the measurements are ordered in
          decreasing order; if FALSE then in increasing order.

pairup.i: subset of vertices to pair up with subset 'pairup.j'.

pairup.j: subset of vertices to pair up with subset 'pairup.i'.

recallSteps: steps of the recall on which to calculate precision.

_D_e_t_a_i_l_s:

     The 'measurementsMatrix' should be symmetric and may have also
     contain 'NA' values which will not be taken into account. That is
     an alternative way to restricting the variable pairs with the
     parameters 'pairup.i' and 'pairup.j'.

_V_a_l_u_e:

     A matrix where rows correspond to recall steps and columns
     correspond, respetively, to the actual recall, the precision, the
     number of true positives at that recall rate and the threshold
     score that yields that recall rate.

_A_u_t_h_o_r(_s):

     R. Castelo and A. Roverato

_R_e_f_e_r_e_n_c_e_s:

     Fawcett, T. An introduction to ROC analysis. _Pattern Recogn.
     Lett._, 27:861-874, 2006.

_S_e_e _A_l_s_o:

     'qpPRscoreThreshold' 'qpGraph' 'qpAvgNrr' 'qpPCC'

_E_x_a_m_p_l_e_s:

     nVar <- 50 # number of variables
     maxCon <- 5  # maximum connectivity per variable
     nObs <- 30 # number of observations to simulate

     I <- qpRndGraph(n.vtx=nVar, n.bd=maxCon)
     K <- qpI2K(I)

     X <- qpSampleMvnorm(K, nObs)

     nrr.estimates <- qpNrr(X, q=5, verbose=FALSE) # NRR !

     pcc.estimates <- qpPCC(X) # PCC !

     # calculate area under the precision-recall curve

     nrr.prerec <- qpPrecisionRecall(nrr.estimates, refI=K!=0, decreasing=FALSE,
                                     recallSteps=seq(0, 1, 0.1))
     f <- approxfun(nrr.prerec[, c("Recall", "Precision")])
     integrate(f, 0, 1)$value

     pcc.prerec <- qpPrecisionRecall(abs(pcc.estimates$R), refI=K!=0,
                                     recallSteps=seq(0, 1, 0.1))
     f <- approxfun(pcc.prerec[, c("Recall", "Precision")])
     integrate(f, 0, 1)$value

