Logistic Regression, Prediction and ROC

Pol1otape peitceil1 ceiet rbgmusml rdcrdtgm rdtts tp

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: 2/cour ses/14SS_BANA7046002/notes%284%29.html 5/15 2/17/2014 Log istic Reg r ession, Pr ediction and ROC # # Peitd rdce # Tuh # rt 0 1 # # 042 11 19 0 # # 1 21 2 4 9 There are many ways to calculate the error rate. The following is one way. The ifelse function returns a vector, the elements are 1 if actual ! = predicted, 0 otherwise. m ean gives you the percentage of 1s in the vector. ma(flecei.ri$ ! peitdgm.nape 1 enies(rdttanY = rdce.l1isml, , 0) ) # 006 #1 .7 Out-of-sample (performance on testing set) To do out-of-sample prediction you need to add the testing set as a second argument after the glm object. Remember to add type = “response”, otherwise you will get the log odds and not the probability. po.l1otape< peitcei.l1 cei.et rbgm.usml - rdc(rdtgm, rdtts, tp ="epne) ye rsos" peitdgm.usml < po.l1otape>02 rdce.l1otape - rbgm.usml . peitdgm.usml < rdce.l1otape a.uei(rdce.l1otape snmrcpeitdgm.usml) tbecei.etY peitdgm.usml,dn= al(rdtts$, rdce.l1otape n c"rt" "rdce") (Tuh, Peitd) # # Peitd rdce # Tuh # rt 01 # # 045 1 5 5 # # 12 82 ma(flecei.et...
View Full Document

Ask a homework question - tutors are online