Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

PLEASE HELP WITH ALL OF THESE # R code goes on the line after each question prompt. # You MUST use Case3_README.docx to answer these

PLEASE HELP WITH ALL OF THESE

# R code goes on the line after each question prompt.

# You MUST use Case3_README.docx to answer these case questions. # CG Q0

# Read in the data as tlmrk.

# CG Q1 # Use the nrow() function to find the nummber of customer records.

# CG Q2 # How many customers in this dataset subscribed to a term deposit product?

# CG Q3 # Find the percent of customers that subscribed to a term deposit product.

# CG Q4a # Fit a logistic regression model for subscribe modeled by all other possible ########## variables in the data set plus the variable durmin squared using the code below. fit <- glm(subscribe ~ . + I(durmin^2), data=tlmrk, family="binomial")

# CG Q4b # Use length() combined with the coef() function to find how many ########## coefficients were estimated by glm().

# CG Q5 # Find the R-squared for the fitted regression by referring to the ######### deviances from summary.glm (use the code from youe lecture examples).

# CG Q6a # Customer 27 in our dataset did not end up subscribing to the term deposit. ########## Let's use our fitted model to see what it would have predicted for this customer. ########## First, create an object called "nd" that that you will pass to the predict() ########## function in the newdata argument.

# CG Q6b # Use your fitted logistic regression and your "newdata" in the predict() ########## function to make a prediction of the probability the customer would subscribe.

# CG Q7 # Use the following code to create a confusion matrix and calculate the PPV. rule <- 1/5 # classification rule yhat <- as.numeric(fit$fitted>rule) # classify subscription status based on your rule table(yhat, actualSubscriptionStatus=tlmrk$subscribe) # confusion matrix # Now, use the confusion matrix to calculate the sensitivity (recall).

# CG Q8 # Now, for a classification rule of 1/12, find the PPV (precision). ######### You should submit 4 separate lines of code.

# CG Q9 # Calculate the specificity for a rule of 1/3 using 4 lines of code again. ######### Name the rule object rule3 and your predicted subscription status yhat3.

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

Database Design Application Development And Administration

Authors: Michael V. Mannino

4th Edition

0615231047, 978-0615231044

More Books

Students also viewed these Databases questions