Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Customer Balance Direct 1 122 No 2 289 No 3 365 Yes 4 398 No 5 409 No 6 491 No 7 524 No 8

Customer Balance Direct
1 122 No
2 289 No
3 365 Yes
4 398 No
5 409 No
6 491 No
7 524 No
8 573 No
9 617 No
10 628 No
11 652 No
12 670 No
13 674 Yes
14 680 No
15 685 Yes
16 698 No
17 726 Yes
18 776 No
19 778 Yes
20 810 Yes
21 975 Yes
22 1011 Yes
23 1019 Yes
24 1037 Yes
25 1169 No
26 1507 Yes
27 1845 Yes
28 2498 No
29 441 No
30 793 Yes
31 391 No
32 506 No
33 761 No
34 1463 Yes
35 628 Yes
36 706 No
37 289 No
38 654 No
39 557 No
40 1033 Yes
41 415 No
42 796 No
43 561 No
44 592 No
45 209 No
46 813 No
47 323 No
48 671 No
49 858 Yes
50 990 Yes
51 493 No
52 372 No
53 647 No
54 1295 Yes
55 1356 Yes
56 960 Yes
57 976 Yes
58 1176 Yes
59 426 No
60 333 No
61 1257 Yes
62 1144 Yes
63 938 Yes
64 620 No
65 361 No
66 300 No
67 596 No
68 527 No
69 1376 Yes
70 1509 Yes
71 263 No
72 324 No
73 850 Yes
74 786 No
75 363 No
76 990 Yes
77 164 No
78 582 No
79 553 No
80 432 No
81 468 No
82 438 No
83 512 No
84 451 No
85 1055 Yes
86 708 Yes
87 555 No
88 377 No
89 812 No
90 271 No
91 317 No
92 383 No
93 191 No
94 915 Yes
95 718 No
96 1001 Yes
97 674 Yes
98 1249 Yes
99 1422 Yes
100 696 No
101 676 No
102 570 No
103 554 No
104 509 No
105 603 No
106 356 No
107 505 No
108 503 No
109 2726 Yes
110 582 No
111 767 Yes
112 1078 Yes
113 629 No
114 831 No
115 505 No
116 697 Yes
117 972 Yes
118 341 No
119 664 Yes
120 1362 Yes
121 1068 Yes
122 1209 Yes
123 1127 Yes
124 1123 Yes
125 781 No
126 159 No
127 516 No
128 582 No
129 841 No
130 1196 Yes
131 550 No
132 458 No
133 1646 Yes
134 607 No
135 744 No
136 2578 Yes
137 589 No
138 540 No
139 340 No
140 542 No
141 335 No
142 377 No
143 263 No
144 221 No
145 1923 Yes
146 565 No
147 424 No
148 401 No
149 609 No
150 468 No
151 377 No
152 571 No
153 902 Yes
154 1337 Yes
155 305 No
156 572 No
157 365 No
158 1365 Yes
159 136 No
160 474 No
161 620 No
162 634 No
163 383 No
164 1299 Yes
165 164 No
166 984 Yes
167 388 No
168 654 No
169 494 No
170 445 No
171 605 No
172 659 No
173 879 No
174 579 No
175 741 No
176 176 No
177 916 Yes
178 987 Yes
179 890 Yes
180 1710 Yes
181 784 Yes
182 1335 Yes
183 375 No
184 1327 Yes
185 482 No
186 857 Yes
187 536 No
188 1108 Yes
189 263 No
190 1578 Yes
191 405 No
192 1312 Yes
193 1329 Yes
194 902 Yes
195 658 No
196 690 No
197 921 Yes
198 239 No
199 417 No
200 1666 Yes
201 348 No
202 455 No
203 556 No
204 808 Yes
205 1196 Yes
206 238 No
207 891 No
208 552 No
209 410 No
210 324 No
211 736 No
212 715 Yes
213 391 No
214 716 Yes
215 609 No
216 162 No
217 368 No
218 625 No
219 1500 Yes
220 1404 Yes
221 1813 Yes
222 635 No
223 353 No
224 699 No
225 652 No
226 560 No
227 663 No
228 569 No
229 362 No
230 687 No
231 1038 Yes
232 692 No
233 823 Yes
234 734 No
235 290 No
236 867 Yes
237 220 No
238 718 No
239 559 No
240 845 Yes
241 278 No
242 335 No
243 1732 Yes
244 633 No
245 393 No
246 229 No
247 158 No
248 1651 Yes
249 665 Yes
250 664 No
251 625 No
252 1359 Yes
253 246 No
254 310 No
255 1140 Yes
256 961 Yes
257 747 Yes
258 1104 Yes
259 536 No
260 962 No
261 220 No
262 795 No
263 1213 Yes
264 943 No
265 548 No
266 352 No
267 295 No
268 633 No
269 1380 Yes
270 1268 Yes
271 1567 Yes
272 659 No
273 191 No
274 462 No
275 613 No
276 382 No
277 989 Yes
278 336 No
279 700 No
280 1045 Yes
281 1452 Yes
282 516 No
283 615 No
284 1108 Yes
285 613 No
286 935 Yes
287 734 No
288 76 No
289 470 No
290 1198 Yes
291 561 No
292 1053 Yes
293 902 No
294 828 Yes
295 819 Yes
296 1726 Yes
297 1178 Yes
298 419 No
299 447 No
300 904 Yes
301 573 No
302 830 No
303 497 No
304 1182 Yes
305 1194 Yes
306 940 Yes
307 466 No
308 273 No
309 687 No
310 398 No
311 373 No
312 817 No
313 529 No
314 425 No
315 795 No
316 329 No
317 991 Yes
318 603 No
319 1389 Yes
320 379 No
321 471 No
322 553 No
323 1397 Yes
324 958 Yes
325 236 No
326 403 No
327 1185 Yes
328 740 No
329 493 No
330 614 Yes
331 658 No
332 498 No
333 293 No
334 442 No
335 306 No
336 518 No
337 382 No
338 554 No
339 793 No
340 1262 Yes
341 446 No
342 519 No
343 862 No
344 327 No
345 1755 Yes
346 361 No
347 490 No
348 601 No
349 239 No
350 421 No
351 521 No
352 445 No
353 717 No
354 612 No
355 664 No
356 293 No
357 1253 Yes
358 240 No
359 452 No
360 612 No
361 841 Yes
362 1261 Yes
363 749 No
364 567 No
365 1049 Yes
366 947 Yes
367 801 Yes
368 259 No
369 1730 Yes
370 462 No
371 704 No
372 556 No
373 1264 Yes
374 422 No
375 1436 Yes
376 1358 Yes
377 268 No
378 165 No
379 818 Yes
380 856 Yes
381 486 No
382 1321 Yes
383 1345 Yes
384 387 No
385 1331 Yes
386 1028 Yes
387 766 No
388 839 Yes
389 267 No
390 988 Yes
391 423 No
392 823 No
393 813 No
394 1338 Yes
395 459 No
396 244 No
397 572 No
398 1231 Yes
399 348 No
400 313 No
401 716 No
402 480 No
403 281 No
404 427 No
405 384 No
406 1017 Yes
407 442 No
408 476 No
409 861 No
410 427 No
411 220 No
412 788 No
413 641 No
414 463 No
415 884 Yes
416 1030 Yes
417 531 No
418 772 No
419 402 No
420 482 No
421 658 Yes
422 339 No
423 1339 Yes
424 333 No
425 123 No
426 365 No
427 661 No
428 212 No
429 834 Yes
430 1520 Yes
431 639 No
432 297 No
433 369 No
434 874 Yes
435 799 No
436 336 No
437 222 No
438 587 No
439 422 No
440 1045 Yes
441 260 No
442 1011 Yes
443 708 Yes
444 814 No
445 492 No
446 485 No
447 1165 Yes
448 512 No
449 1574 Yes
450 464 No
451 655 No
452 806 Yes
453 1355 Yes
454 298 No
455 1029 Yes
456 981 Yes
457 990 No
458 834 No
459 951 Yes
460 863 No
461 275 No
462 432 No
463 2178 Yes
464 280 No
465 1159 Yes
466 500 No
467 274 No
468 489 No
469 322 No
470 167 No
471 267 No
472 1152 Yes
473 787 No
474 707 Yes
475 616 No
476 1297 Yes
477 362 No
478 1164 Yes
479 1431 Yes
480 641 No
481 518 No
482 309 No
483 564 No
484 671 No
485 587 No
486 391 No
487 410 No
488 1394 Yes
489 541 No
490 261 No
491 376 No
492 193 No
493 996 No
494 678 Yes
495 488 No
496 494 No
497 612 No
498 965 Yes
499 1146 Yes
500 578 No
501 738 Yes
502 369 No
503 1074 Yes
504 198 No
505 771 No
506 446 No
507 1147 Yes
508 540 No
509 556 No
510 905 Yes
511 431 No
512 836 No
513 1159 Yes
514 339 No
515 243 No
516 525 No
517 529 No
518 1334 Yes
519 946 Yes
520 681 No
521 898 Yes
522 770 No
523 802 No
524 983 Yes
525 537 No
526 793 No
527 757 No
528 782 No
529 346 No
530 1265 Yes
531 818 No
532 182 No
533 475 No
534 830 Yes
535 314 No
536 1375 Yes
537 494 No
538 509 No
539 1556 Yes
540 329 No
541 496 No
542 525 No
543 559 No
544 1287 Yes
545 821 Yes
546 675 No
547 371 No
548 140 No
549 1092 Yes
550 2605 Yes
551 964 Yes
552 373 No
553 871 Yes
554 86 No
555 426 No
556 451 No
557 298 No
558 583 No
559 663 No
560 734 No
561 894 Yes
562 255 No
563 406 No
564 633 No
565 350 No
566 1009 Yes
567 883 Yes
568 161 No
569 378 No
570 1815 Yes
571 262 No
572 258 No
573 573 No
574 217 No
575 167 No
576 849 Yes
577 1365 Yes
578 815 No
579 634 No
580 933 No
581 561 No
582 720 No
583 182 No
584 283 No
585 893 Yes
586 141 No
587 1130 Yes
588 1152 Yes
589 156 No
590 712 Yes
591 249 No
592 389 No
593 1282 Yes
594 386 No
595 1025 Yes
596 688 No
597 268 No
598 798 No
599 1229 Yes
600 536 No
601 572 No
602 719 No
603 222 No
604 157 No
605 898 No
606 309 No
607 553 No
608 1518 Yes
609 779 No
610 806 No
611 559 No
612 878 Yes
613 753 No
614 722 No
615 174 No
616 717 No
617 378 No
618 389 No
619 419 No
620 910 No
621 1829 Yes
622 1346 Yes
623 540 No
624 1165 Yes
625 639 No
626 610 No
627 439 No
628 683 Yes
629 1312 Yes
630 344 No
631 809 No
632 552 No
633 433 No
634 663 No
635 248 No
636 426 No
637 541 No
638 617 No
639 606 No
640 1028 Yes
641 667 No
642 298 No
643 491 No
644 893 Yes
645 390 No
646 853 Yes
647 500 No
648 920 Yes
649 559 No
650 979 No
651 625 No
652 723 No
653 936 Yes
654 537 No
655 126 No
656 899 No
657 270 No
658 961 Yes
659 418 No
660 783 No
661 287 No
662 766 No
663 725 No
664 372 No
665 633 No
666 693 No
667 583 No
668 1468 Yes
669 1245 Yes
670 673 Yes
671 866 No
672 525 No
673 461 No
674 457 No
675 616 No
676 752 Yes
677 349 No
678 558 No
679 554 No
680 642 No
681 723 No
682 1454 Yes
683 767 No
684 225 No
685 689 No
686 675 Yes
687 956 Yes
688 421 No
689 386 No
690 215 No
691 130 No
692 922 Yes
693 680 Yes
694 523 No
695 613 No
696 638 No
697 1092 No
698 1524 Yes
699 763 Yes
700 437 No
701 1754 Yes
702 688 No
703 337 No
704 860 No
705 693 No
706 718 No
707 424 No
708 737 Yes
709 554 No
710 1151 Yes
711 1093 Yes
712 1490 Yes
713 313 No
714 535 No
715 690 No
716 538 No
717 282 No
718 388 No
719 355 No
720 437 No
721 397 No
722 629 No
723 895 Yes
724 665 No
725 733 Yes
726 1078 Yes
727 943 No
728 1097 Yes
729 680 No
730 310 No
731 1179 Yes
732 713 No
733 1135 Yes
734 357 No
735 585 No
736 119 No
737 652 No
738 686 Yes
739 1645 Yes
740 924 No
741 241 No
742 630 No
743 1138 Yes
744 600 No
745 367 No
746 1000 No
747 256 No
748 1058 Yes
749 138 No
750 1009 Yes
751 655 No
752 575 No
753 593 No
754 304 No
755 1078 Yes
756 510 No
757 941 No
758 328 No
759 376 No
760 1009 Yes
761 276 No
762 509 No
763 606 No
764 1553 Yes
765 1298 Yes
766 1534 Yes
767 1744 Yes
768 699 Yes
769 375 No
770 1002 Yes
771 650 No
772 512 No
773 131 No
774 341 No
775 772 Yes
776 1135 Yes
777 1116 Yes
778 276 No
779 1044 Yes
780 900 No
781 730 No
782 519 No
783 1247 Yes
784 210 No
785 1131 Yes
786 390 No
787 865 Yes
788 1039 Yes
789 614 No
790 108 No
791 760 Yes
792 364 No
793 960 Yes
794 639 No
795 963 Yes
796 515 No
797 588 No
798 982 Yes
799 1991 Yes
800 984 Yes
801 775 No
802 162 No
803 778 No
804 1508 Yes
805 478 No
806 505 No
807 1298 Yes
808 931 Yes
809 759 Yes
810 485 No
811 763 No
812 277 No
813 1601 Yes
814 484 No
815 595 No
816 402 No
817 1769 Yes
818 1025 Yes
819 666 No
820 1063 Yes
821 987 Yes
822 545 No
823 338 No
824 1027 Yes
825 1104 Yes
826 967 No
827 466 No
828 224 No
829 376 No
830 841 No
831 469 No
832 535 No
833 464 No
834 375 No
835 343 No
836 356 No
837 541 No
838 483 No
839 323 No
840 507 No
841 2087 Yes
842 342 No
843 963 Yes
844 742 No
845 566 No
846 332 No
847 767 No
848 563 No
849 711 No
850 373 No
851 452 No
852 879 Yes
853 955 Yes
854 932 Yes
855 596 No
856 441 No
857 323 No
858 253 No
859 773 Yes
860 714 No
861 491 No
862 538 No
863 1115 Yes
864 1036 Yes
865 417 No
866 513 No
867 651 Yes
868 1015 No
869 1051 Yes
870 713 No
871 1382 Yes
872 944 Yes
873 553 No
874 641 Yes
875 1048 Yes
876 490 No
877 974 Yes
878 415 No
879 827 No
880 1124 Yes
881 805 Yes
882 720 No
883 617 Yes
884 352 No
885 583 No
886 343 No
887 450 No
888 1282 Yes
889 534 No
890 528 No
891 480 No
892 485 No
893 1443 Yes
894 192 No
895 538 No
896 377 No
897 355 No
898 714 No
899 918 Yes
900 423 No
901 668 No
902 935 Yes
903 707 No
904 525 No
905 575 No
906 626 No
907 486 No
908 407 No
909 584 No
910 573 No
911 1008 Yes
912 455 No
913 856 No
914 1307 Yes
915 583 No
916 550 No
917 461 No
918 539 No
919 775 No
920 1108 Yes
921 1264 Yes
922 887 Yes
923 1653 Yes
924 684 No
925 776 No
926 1140 Yes
927 444 No
928 517 No
929 883 No
930 615 No
931 611 No
932 1450 Yes
933 467 No
934 1568 Yes
935 471 No
936 1657 Yes
937 317 No
938 127 No
939 768 No
940 920 Yes
941 565 No
942 527 No
943 365 No
944 971 Yes
945 452 No
946 570 No
947 837 No
948 559 No
949 509 No
950 476 No
951 658 No
952 356 No
953 898 Yes
954 247 No
955 895 No
956 481 No
957 571 No
958 946 Yes
959 951 Yes
960 238 No
961 457 No
962 743 No
963 961 Yes
964 576 No
965 372 No
966 1070 Yes
967 763 No
968 872 Yes
969 493 No
970 794 No
971 465 No
972 594 No
973 305 No
974 346 No
975 1818 Yes
976 842 Yes
977 753 No
978 1406 Yes
979 715 Yes
980 1102 Yes
981 1171 Yes
982 532 No
983 368 No
984 782 No
985 335 No
986 327 No
987 203 No
988 394 No
989 185 No
990 534 No
991 587 No
992 609 No
993 1178 Yes
994 509 No
995 268 No
996 521 No
997 483 No
998 847 Yes
999 1024 Yes
1000 682 No
1001 624 No
1002 962 No
1003 196 No
1004 866 No
1005 656 No
1006 1616 No
1007 880 No
1008 1777 No
1009 821 No
1010 541 No
1011 2039 No
1012 902 No
1013 1143 No
1014 1097 No
1015 532 No
1016 214 No
1017 858 No
1018 466 No
1019 949 No
1020 998 No
1021 555 No
1022 69 No
1023 921 No
1024 489 No
1025 462 No
1026 710 No
1027 1015 No
1028 581 No
1029 639 No
1030 440 No
1031 187 No
1032 1044 No
1033 760 No
1034 592 No
1035 940 No
1036 86 No
1037 391 No
1038 654 No
1039 101 No
1040 321 No
1041 678 No
1042 763 No
1043 823 No
1044 509 No
1045 667 No
1046 695 No
1047 1497 No
1048 1239 No
1049 276 No
1050 1075 No
1051 1322 No
1052 1110 No
1053 1424 No
1054 211 No
1055 1364 No
1056 867 No
1057 407 No
1058 646 No
1059 395 No
1060 902 No
1061 427 No
1062 1228 No
1063 1008 No
1064 537 No
1065 444 No
1066 451 No
1067 857 No
1068 118 No
1069 688 No
1070 1564 No
1071 2754 No
1072 1011 No
1073 435 No
1074 795 No
1075 1064 No
1076 1307 No
1077 443 No
1078 1104 No
1079 564 No
1080 1106 No
1081 305 No
1082 660 No
1083 407 No
1084 1329 No
1085 1085 No
1086 513 No
1087 429 No
1088 1327 No
1089 1023 No
1090 94 No
1091 988 No
1092 1323 No
1093 1050 No
1094 794 No
1095 769 No
1096 834 No
1097 603 No
1098 488 No
1099 608 No
1100 168 No
1101 1015 No
1102 1203 No
1103 1418 No
1104 1439 No
1105 934 No
1106 1014 No
1107 974 No
1108 1226 No
1109 632 No
1110 2070 No
1111 708 No
1112 411 No
1113 837 No
1114 1450 No
1115 1358 No
1116 1982 No
1117 908 No
1118 873 No
1119 957 No
1120 1677 No
1121 582 No
1122 1195 No
1123 713 No
1124 1136 No
1125 397 No
1126 2252 No
1127 436 No
1128 449 No
1129 569 No
1130 1135 No
1131 1108 No
1132 532 No
1133 251 No
1134 1241 No
1135 254 No
1136 241 No
1137 847 No
1138 1033 No
1139 883 No
1140 834 No
1141 986 No
1142 879 No
1143 1876 No
1144 825 No
1145 752 No
1146 1317 No
1147 656 No
1148 1717 No
1149 1382 No
1150 1359 No
1151 1420 No
1152 749 No
1153 557 No
1154 472 No
1155 461 No
1156 114 No
1157 691 No
1158 984 No
1159 399 No
1160 563 No
1161 1101 No
1162 427 No
1163 1308 No
1164 196 No
1165 1096 No
1166 470 No
1167 499 No
1168 720 No
1169 1282 No
1170 1095 No
1171 473 No
1172 612 No
1173 737 No
1174 572 No
1175 251 No
1176 884 No
1177 611 No
1178 1316 No
1179 722 No
1180 1267 No
1181 256 No
1182 1207 No
1183 493 No
1184 275 No
1185 694 No
1186 1078 No
1187 701 No
1188 1220 No
1189 1295 No
1190 1193 No
1191 963 No
1192 963 No
1193 1069 No
1194 1070 No
1195 173 No
1196 329 No
1197 1261 No
1198 358 No
1199 665 No
1200 1179 No

Sandhills Bank would like to increase the number of customers who use payroll direct deposit as part of the rollout of its new e-banking platform. Management has proposed offering an increased interest rate on a savings account if customers sign up for direct deposit into a checking account. To determine whether this proposal is a good idea, management would like to estimate how many of the 200 current customers who do not use direct deposit would accept the offer. The IT company that handles Sandhills Bank's e-banking has provided anonymized data for 1,000 customers from one of its other client banks that made a similar promotion to increase direct deposit participation. For these 1,000 customers (which correspond to the first 1,000 observations in the fileSandhills), each observation consists of the average monthly checking account balance and whether the customer signed up for direct deposit. Sandhills has designated the data corresponding to its 200 current customers as the test set and these customers are the last 200 observations in the fileSandhills(observations 1,001 to 1,200). As Sandhills has not yet launched its promotion to any of these 200 customers, it has entered an artificial value of zero (i.e., "No") for whether they have signed up for direct deposit. As some of these 200 customers will be the target of the direct-deposit promotion, Sandhills would like to estimate the likelihood of these customers signing up for direct deposit based on their average monthly balance. Classify the data usingk-nearest neighbors for a range of values ofk. Use Balance as the input variable and Direct as the target (or response) variable.

Use the following steps to classify observations using thek-nearest neighbor method in R:

Step 1: Load and activate the necessary packages.
library(caret)
Step 2: Read in data from the file located in the working directory.
df <- read.csv("sandhills.csv")
Step 3: Remove the Customer variable which indexes the data set.
df <- df[,-1]
Step 4: Set the random number seed (to ensure reproducibility of code).
set.seed(1975)
Step 5: Partition the data using the first 1,000 observations for the train set and the last 200 observations for the test set.
training <- df[1:1000,] testing <- df[1001:1200,]
Step 6: View the percentage of no's and yes's in the Direct variable in the train set.
prop.table(table(training$Direct))
Step 7: Specify repeated cross-validation with 10 folds, repeated 1 time, with oversampling to address the class imbalance issue.
ctrl <- trainControl(method = "repeatedcv", number = 10, repeats = 1, sampling = "up")
Step 8: Identify the value ofkthat maximizes accuracy fork-NN.
knnFit <- train(Direct ~ ., data = training, method = "knn", trControl = ctrl, preProcess = c("center","scale"), tuneLength = 30)
Step 9: List the output of the cross-validation and plot the classification accuracy (averaged over 10 cross-validation iterations) for various values ofk.
knnFit plot(knnFit)
Step 10: Generate thek-NN classification of each observation in the test set.
knnPredict <- predict(knnFit, newdata = testing)
Step 11: Compute performance measures ofk-NN on the test set using "Yes" as the positive class.
confusionMatrix(knnPredict, testing$Direct, positive = "Yes")
(a) For a default cutoff value of 0.5, what value ofkminimizes the overall error rate on a static validation set or through a 10-fold cross-validation procedure?
(b) For a cutoff value of 0.5 and the value ofkidentified in part (a), how many of Sandhills Bank's 200 customers (in the test set) doesk-nearest neighbors classify as enrolling in direct deposit?

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

A First Course in Differential Equations with Modeling Applications

Authors: Dennis G. Zill

11th edition

1305965728, 978-1305965720

More Books

Students also viewed these Mathematics questions

Question

Discuss the use of third-wave therapies in psychotherapy practice.

Answered: 1 week ago