Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

How to solve this question by using R Language? You can attach the Boston data set in the MASS package. library(MASS) attach(Boston) For the Boston

How to solve this question by using R Language?

You can attach the Boston data set in the MASS package.

library(MASS)

attach(Boston)

For the Boston data set, we are interested in predicting whether a given suburb has a

crime rate above or below the median given other information in the data.

(a) Conduct the logistic regression analysis using all the predictors. To do the pre-

diction, use the first 405 rows as the training set and the rest as the test set.

Describe your result, include the error table and report the test error rate.

(b) Employ the LDA method using all the predictors. To do the prediction, use the

first 405 rows as the training set and the rest as the test set. Describe your result,

include the error table and report the test error rate.

(c) Employ KNN method using all the predictors. To do the prediction, use the first

405 rows as the training set and the rest as the test set. Use 5 fold cross-validation

to choose k by splitting the training set into 5 equal-sized subsets. What is the

optimal value of k? Describe your result, include the error table and report the

test error rate.

(d) Which method is the best? Logistic regression, LDA or KNN? Why?

(e) For the logistic regression in (a), perform forward and backward model selections

[Hint: you can use the step() function in R]. Repeat (a) using only the selected

predictors. Compare the full model and selected model(s), which model is better

and why?

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

Graph Databases

Authors: Ian Robinson, Jim Webber, Emil Eifrem

1st Edition

1449356265, 978-1449356262

More Books

Students also viewed these Databases questions

Question

=+applying to all or most employers and employees?

Answered: 1 week ago

Question

=+associated with political parties and if so, which ones? Are

Answered: 1 week ago