evaluateRisk             package:rattle             R Documentation

_S_u_m_m_a_r_i_s_e _t_h_e _p_e_r_f_o_r_m_a_n_c_e _o_f _a _d_a_t_a _m_i_n_i_n_g _m_o_d_e_l

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

     By taking predicted values, actual values, and measures of the
     risk associated with each case, generate a summary that groups the
     distinct predicted values, calculating the accumulative percentage
     Caseload, Recall, Risk, Precision, and Measure.

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

     evaluateRisk(predicted, actual, risks)

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

predicted: a numeric vector of probabilities (between 0 and 1)
          representing the probability of each entity being a 1.

  actual: a numeric vector of classes (0 or 1).

   risks: a numeric vector of risk (e.g., dollar amounts) associated
          with each entity that has a acutal of 1.

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

     Graham.Williams@togaware.com

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

     Package home page: <URL: http://rattle.togaware.com>

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

     'plotRisk'.

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

     ## simulate the data that is typical in data mining

     ## we often have only a small number of positive known case
     cases <- 1000
     actual <- as.integer(rnorm(cases) > 1)
     adjusted <- sum(actual)
     nfa <- cases - adjusted

     ## risks might be dollar values associated adjusted cases
     risks <- rep(0, cases)
     risks[actual==1] <- round(abs(rnorm(adjusted, 10000, 5000)), 2)

     ## our models will generated a probability of a case being a 1
     predicted <- rep(0.1, cases) 
     predicted[actual==1] <- predicted[actual==1] + rnorm(adjusted, 0.3, 0.1)
     predicted[actual==0] <- predicted[actual==0] + rnorm(nfa, 0.1, 0.08)
     predicted <- signif(predicted)

     ## call upon evaluateRisk to generate performance summary
     ev <- evaluateRisk(predicted, actual, risks)

     ## have a look at the first few and last few
     head(ev)
     tail(ev)

     ## the performance is usually presented as a Risk Chart
     ## under the CRAN MS/Windows this causes a problem, so don't run for now
     ## Not run: plotRisk(ev$Caseload, ev$Precision, ev$Recall, ev$Risk)

