Question: Using R Studio, complete the following: Personal Loan Acceptance. The file UniversalBank.csv contains data on 5 0 0 0 customers of Universal Bank. The data
Using R Studio, complete the following:
Personal Loan Acceptance. The file UniversalBank.csv contains data on customers of Universal Bank. The data include customer demographic information age income, etc. the customers relationship with the bank mortgage securities account, etc. and the customer response to the last personal loan campaign Personal Loan Among these customers, only accepted the personal loan that was offered to them in the earlier campaign. In this exercise, we focus on two predictors: Online whether or not the customer is an active user of online banking services and Credit Card abbreviated CC belowdoes the customer hold a credit card issued by the bank and the outcome Personal Loan abbreviated Loan below
Partition the data into training and validation sets.
a Create a pivot table for the training data with Online as a column variable, CC as a row variable, and Loan as a secondary row variable. The values inside the table should convey the count. In R use functions melt and cast or function table
b Consider the task of classifying a customer who owns a bank credit card and is actively using online banking services. Looking at the pivot table, what is the probability that this customer will accept the loan offer? This is the probability of loan acceptance Loan conditional on having a bank credit card CC and being an active user of online banking services Online
c Create two separate pivot tables for the training data. One will have Loan rows as a function of Online columns and the other will have Loan rows as a function of CC
d Compute the following quantities PA B means the probability of A given B:
i PCC Loan the proportion of credit card holders among the loan acceptors
ii POnline Loan
iii. PLoan the proportion of loan acceptors
iv PCC Loan
v POnline Loan
vi PLoan
e Use the quantities computed above to compute the naive Bayes probability
PLoan CC Online
f Compare this value with the one obtained from the pivot table in b Which is a more accurate estimate?
g Which of the entries in this table are needed for computing PLoan CC Online In R run naive Bayes on the data. Examine the model output on training data, and find the entry that corresponds to PLoan CC Online Compare this to the number you obtained in e
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
