### Our Services

Get 15% Discount on your First Order

# check the attachements Please read the instructions and questions carefully in ” Assignment_4_2023_Fall.pdf” file and use “Auto.csv” to

check the attachements

Please read the instructions and questions carefully in ” Assignment_4_2023_Fall.pdf” file and use “Auto.csv” to finish the assignment. You should submit both 1) an R code ; 2) A PDF report with answers through the link “Submit Assignment 4 Here”

Guidelines:

· Use only R for this assignment

· Submit both R code and Report on findings

· Work is to be done individually for this assignment

Fitting a Classification Tree

1.
This problem involves the OJ data set which is part of the ISLR package (
Hint: the first three lines of codes should be: library (tree), library (ISLR), attach (OJ)).

1.1 Create a training set containing a random sample of 800 observations, and a test set containing the remaining observations. Take a screenshot of your code. (Hint: set.seed (2), train=sample())

1.2 Fit a tree to
the training data, with
Purchase as the response and the other variables as predictors. Use the summary( ) function to produce summary statistics about the tree. Take a screenshot of the summary statistics. How many terminal nodes does the tree have? What is the training misclassification error rate?

1.3 Plot the tree and take a screenshot of the tree (Hint: plot() and text())

1.4 Predict the response on the test data, and produce a confusion matrix comparing the test labels to the predicted test labels. What is the accuracy rate?

1.5 Apply the cv.tree() function to the training set in order to determine the optimal tree size. (Use set.seed(7)). Print the results (Hint: the results should contain the size, k, method etc).

1.6 Produce a plot with tree size (i.e. size) on the x-axis and cross-validated classification error rate (i.e. dev) on the y-axis.

1.7 Which tree size corresponds to the lowest cross-validated classification error rate (i.e. dev)?

1.8 Produce a pruned tree corresponding to the optimal tree size obtained using cross-validation. Take a screenshot of a pruned tree. What is the accuracy rate for the pruned tree? Is it improved compared to the accuracy rate in (1.4)?

1.9 If cross-validation does not lead to selection of a pruned tree (i.e. the accuracy rate produced in (1.8) is lower than the one in (1.4)), then create a pruned tree with five terminal nodes. What is the accuracy rate now?

1

Fitting a Regression Tree

2.
In the lab, a classification tree was applied to the Carseats data set after converting Sales into a qualitative response variable. Now we will seek to predict Sales using regression trees and related approaches, treating the response as a quantitative variable.

2.1 Using the validation-set approach to split the data set into a training set and a test set (Hint:
use set.seed(2); validation-set approach: half of the observations are selected as the training dataset while half of observations are treated as the test dataset). Take a screenshot of your code.

2.2 Fit a regression tree to the training set.

a) Use summary () to print out the results. How many terminal nodes do you get? What is RMD (Residual Mean Deviance)?

b) Plot the tree and take a screenshot of the tree;

c) What test MSE do you obtain?

2.3 Use cross-validation in order to determine the optimal level of tree complexity (use set.seed(2)).

a) Produce a plot with tree size on the x-axis and cross-validated classification error rate on the y-axis.

b) What is the optimal level of tree complexity?

c) Using the optimal level of tree size to prune the tree, does pruning the tree improve the test MSE?

2.4 Use the bagging approach in order to analyze this data. Take a screenshot of the results. What test MSE do you obtain? (Hint: use set.seed (1);
mtry=10 since we have 10 predictors in Carseats dataset and we use all of the predictors in the bagging approach).

2.5 Use random forests to analyze this data.

a) What test MSE do you obtain? (Hint: use set.seed(1);
mtry=10/3 since we usually use 1/3 of the predictors when building a random forest of regression trees)

b) Use the importance() function to determine which variables are most important. Take a screenshot of your results.

c) Plots of these importance measures can be produced using the varImpPlot() function. Take a screenshot of your output.

d) So which variables are most important?

What to submit:

1. R code.

a.

b.

c.

d.

2. Report.

a.

b.

c.

d.

e.

Should include all the code to accomplish the tasks.

Clear and concise comments to indicate what part of the assignment each code chunk pertains to.

Filename should be in the format of: LastnameFirstname_A4.R

Take screenshots of your outputs in R Studio and answer all the questions. Submit in PDF format.

Includes appropriate plots. Make sure the plots are properly labeled.

The assignment will be graded on the correctness of the answers, comprehensiveness of the analysis, clarity of results’ presentation and neatness of the report.

Order a Similar Paper and get 15% Discount on your First Order

## Related Questions

### Lab – Configure IPv6 Addresses on Network Devices Lab – Configure IPv6 Addresses on Network Devices Topology Addressing

Lab – Configure IPv6 Addresses on Network Devices Lab – Configure IPv6 Addresses on Network Devices Topology Addressing Table Device Interface IPv6 Address Prefix Length Default Gateway R1 G0/0/0 2001:db8:acad:a::1 64 N/A R1 G0/0/1 2001:db8:acad:1::1 64 N/A S1 VLAN 1 2001:db8:acad:1::b 64 N/A PC-A NIC 2001:db8:acad:1::3 64 fe80::1 PC-B NIC

### Assignment 5 Due Saturday 11:59 pm (Week 12) Part 1 (40 points) This dataset contains State-by-state data on COVID-19 vaccinations in the United

Assignment 5 Due Saturday 11:59 pm (Week 12) Part 1 (40 points) This dataset contains State-by-state data on COVID-19 vaccinations in the United States from 1/2/2021 to 8/2/2021. You will be required to answer the following questions by timeseries analysis. * For vaccines that require multiple doses, each individual dose

,, I will upload more information about it to know better about the material Hi all, the instructions for the final project are attached. You are allowed to finish the project within 2 days at most. you can choose and tell me which option is easy and fast you

### file attached Read “Case 14.3: AI at Airbnb” and write an essay that answers the following questions: 1. How has Airbnb’s

file attached Read “Case 14.3: AI at Airbnb” and write an essay that answers the following questions: 1. How has Airbnb’s business model transformed the travel industry? 2. How does Airbnb use sentiment analysis to improve its services? 3. How does text mining help Airbnb gain insights from guest reviews?

### Prepare First, download and install CrypTool. If using a Windows® PC, install CrypTool 1.  If using a MAC PC, install JCrypTool. Note: In order for

Prepare First, download and install CrypTool. If using a Windows® PC, install CrypTool 1.  If using a MAC PC, install JCrypTool. Note: In order for the CrypTool program to function, you must first OPEN a text file. Only then will items on the toolbar become enabled. Additional information for this

### Why is an update/patch process crucial for any organization to have and follow?  Discuss some issues that may arise when patching and updating

Why is an update/patch process crucial for any organization to have and follow?  Discuss some issues that may arise when patching and updating machines.

Tasks may not be submitted as cloud links, such as links to Google Docs, Google Slides, OneDrive, etc., unless specified in the task requirements. All other submissions must be file types that are uploaded and submitted as attachments (e.g., .docx, .pdf, .ppt). A.  Address ethical issues for cybersecurity by

### The Cybersecurity Analyst’s Toolbox (Required/Graded) Discussion Topic During job interviews, employers often ask if you are

The Cybersecurity Analyst’s Toolbox (Required/Graded) Discussion Topic During job interviews, employers often ask if you are familiar with cybersecurity software. For this reason, it is a good idea to become familiar with commonly used software, including capabilities and limitations. These software products are the tools for conducting your day-to-day duties.

### Explain the differences between desktop and laptop architecture.  What features are specific to laptops and laptop displays? Describe the evolution of

Explain the differences between desktop and laptop architecture.  What features are specific to laptops and laptop displays? Describe the evolution of laptops into other mobile devices.

### I’m working on a WebApp platform React project. I have a small requiement that needs to be done. Enabling file upload option for a text field. I have

I’m working on a WebApp platform React project. I have a small requiement that needs to be done. Enabling file upload option for a text field. I have added a screenshot to understand the requirement better.

Linux Project programming Directions 1. Log in to (username-techballer) (Password-Starcyber55) 2. Click first box that says Rio Salado College Linux Operating System. 3. To the left stroll down and click Final Project to complete.

### I need exercise 4 and 5 ASAP lab09/noccalula-falls.bmp lab09/jaguar.jpg lab09/cheetah-family.jpg lab09/secret04.txt Reintroduction of

I need exercise 4 and 5 ASAP lab09/noccalula-falls.bmp lab09/jaguar.jpg lab09/cheetah-family.jpg lab09/secret04.txt Reintroduction of the cheetah in India involves the re-establishment of a population of cheetahs into areas where they had previously existed but were hunted into extinction during and after the Mughal Period, largely by Rajput and Maratha Indian royalty

### Create infographic on Mac Sublayer One page, landscape orientation Try to explain without defining. Try to include analogies, acronyms and real world

Create infographic on Mac Sublayer One page, landscape orientation Try to explain without defining. Try to include analogies, acronyms and real world examples Include pictures, diagrams, tables Try not use too much AI please Below is an example:

### Assignment 4 Due Saturday 11:59 pm (Week 10) In this assignment, you will be required to do research about Decision tree Regressor and other

Assignment 4 Due Saturday 11:59 pm (Week 10) In this assignment, you will be required to do research about Decision tree Regressor and other common regressions such as Ridge Regression, Lasso Regression, and Logistic Regression. Like Assignment 3, you will need to do the research about these regression models, but

### Lab – Building a Switch and Router Network Lab – Building a Switch and Router Network Topology

Lab – Building a Switch and Router Network Lab – Building a Switch and Router Network Topology Addressing Table Device Interface IP Address Subnet Mask Default Gateway R1 G0/0 192.168.0.1 255.255.255.0 N/A G0/1 192.168.1.1 255.255.255.0 N/A PC-A NIC 192.168.1.3 255.255.255.0 192.168.1.1 PC-B NIC 192.168.0.3 255.255.255.0 192.168.0.1 Objectives Part 1: Set

### Turnitin Turnitin enabledThis assignment will be submitted to Turnitin. Instructions Body paragraphs (sometimes called “discussion sections”) are

Turnitin™ Turnitin™ enabledThis assignment will be submitted to Turnitin™. Instructions Body paragraphs (sometimes called “discussion sections”) are the parts of your essay that aren’t the intro or conclusion. Each of these paragraphs will have: a leading topic sentence that states the paragraph’s focus, evidence (quotes, examples, or research), and analysis

### CSIA 413 project 3         CSIA 459 project 1 and 2 CSIA 413: Cybersecurity Policy, Plans, and Programs Project #3: IT Audit

CSIA 413 project 3         CSIA 459 project 1 and 2 CSIA 413: Cybersecurity Policy, Plans, and Programs Project #3: IT Audit Policy and Plans Company Background & Operating Environment Red Clay Renovations is an internationally recognized, awarding winning firm that specializes in the renovation and rehabilitation of residential buildings and

### 1 IT Audit project and 1 IT Risk Management project ACS | RECOGNITION OF PRIOR LEARNING INSTRUCTION DOCUMENT  2023 Page 1 ACS RECOGNTION OF

1 IT Audit project and 1 IT Risk Management project ACS | RECOGNITION OF PRIOR LEARNING INSTRUCTION DOCUMENT  2023 Page 1 ACS RECOGNTION OF PRIOR LEARNING (RPL) INSTRUCTION DOCUMENT – 2023 This document provides detailed instructions and information to assist you in completing the ACS Recognition of Prior Learning