Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Wondering how the sketch would look like for the question below. **QUESTION FROM CHAPTER 8 -QUESTION 9 OF 'An Introduction to Statistical Learning with Applications

Wondering how the sketch would look like for the question below.

**QUESTION FROM CHAPTER 8 -QUESTION 9 OF 'An Introduction to Statistical Learning with Applications in R**

2) Sketch the tree (part a), and the partition of the predictor space (part b), by hand.

PART A

```{r} set.seed(1) library(ISLR) train=sample(1:nrow(OJ),800,replace=F) OJtrain=OJ[train,] OJtest=OJ[-train,]

```

PART B

```{r} library(tree) tree.oj=tree(Purchase ~ ., data = OJtrain) summary(tree.oj) ```

PART B OUTCOME

Classification tree: tree(formula = Purchase ~ ., data = OJtrain) Variables actually used in tree construction: [1] "LoyalCH" "PriceDiff" "SpecialCH" "ListPriceDiff" "PctDiscMM" Number of terminal nodes: 9 Residual mean deviance: 0.7432 = 587.8 / 791 Misclassification error rate: 0.1588 = 127 / 800 

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

Auditing The Master A Tax Collector Report

Authors: B. Cobbey Crisler

1st Edition

1912297108, 978-1912297108

More Books

Students also viewed these Accounting questions