Wondering how the sketch would look like for the question below. **QUESTION FROM CHAPTER...

50.1K

Verified Solution

Question

Accounting

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 

Answer & Explanation Solved by verified expert
Get Answers to Unlimited Questions

Join us to gain access to millions of questions and expert answers. Enjoy exclusive benefits tailored just for you!

Membership Benefits:
  • Unlimited Question Access with detailed Answers
  • Zin AI - 3 Million Words
  • 10 Dall-E 3 Images
  • 20 Plot Generations
  • Conversation with Dialogue Memory
  • No Ads, Ever!
  • Access to Our Best AI Platform: Flex AI - Your personal assistant for all your inquiries!
Become a Member

Other questions asked by students