[R] binary response: from p_hat to 0, 1

noclue_ tim.liu at netzero.net
Mon Mar 15 23:09:47 CET 2010

I am using PROC LOGISTIC to model binary outcomes.

I have observed Y (1 or 0) from original data.

I also have got predicted probability for each observation (i.e. predicted 
probability of event Y=1) from PROC LOGISTIC. Let us call it - p_hat.

for example, I would have two columns -

Y  p_hat
1  0.6
0  0.3
1  0.45

I would like to build a 2X2 classification table -  

Y =1, Y =0 vs. Y_hat=1, Y_hat =0 

to evaluate my classification accuracy.

The challenge is - how to derive Y_hat from p_hat?  what threshold shall I 
use to say --

if p_hat > .. then Y_hat = 1
else               Y_hat = 0


Besides, do I have to come up with thresholds/cutting points also for KNN,
Neural Net, 
RandomForest and rpart prediction?




View this message in context: http://n4.nabble.com/binary-response-from-p-hat-to-0-1-tp1594105p1594105.html
Sent from the R help mailing list archive at Nabble.com.

More information about the R-help mailing list