0% found this document useful (0 votes)
14 views

Ineg4163 Homework (Classification and Regression Tree) : Load ("Path To The Data On Your Computer/Data3.Rdata")

Uploaded by

Riya Sharma
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views

Ineg4163 Homework (Classification and Regression Tree) : Load ("Path To The Data On Your Computer/Data3.Rdata")

Uploaded by

Riya Sharma
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

INEG4163

Homework (Classification and Regression Tree)


Name: Dhiraj Pokhrel
Please carefully read the following instructions:
 Please submit the homework before 11:59pm, Feb 18.
 Please directly add your answers/solutions to this word file. After you finish your
homework, please save this word file to pdf, and upload the pdf file by
“View/Complete Assignment… link in the course Content area” on Blackboard

Step 1: Go to Blackboard, download “data3.RData” from the “data” folder, and save it to
your computer (remember where you save it).
Step 2: Open R, and load this data by running the following R code:
load("path to the data on your computer/data3.RData")
Step 3: After the data has been loaded, select the columns that we would like to use by
running the following code (because we don’t need all columns in this homework):
data = data3[,c("o3","T","w_x","w_y","L1","L2","L3","L4","L5")]
Here, “o3” is the response, while other columns are the features.

Next, please answer the following questions:

Question 1). Use the “rpart” function to build a regression tree with cp= 0.0005 (using all
features). Plot the tree and insert your plot below (note that, when you plot the tree, set
“uniform = TRUE” for better visualization) (3 points)
Question 2). Investigate the relationship between the tree performance and the choice of
cp using the function “plotcp”. Insert the plot below (3 points)
Question 3). Based on the plot above, choose an appropriate value for cp, prune the tree
using the “prune” function, and show the pruned tree below (3 points)

Question 4). Based on the tree above, can you tell which feature is the perhaps the most
important one? And why? (1 point)
 Based on the tree above the most important feature is T, because the first node is
branched based on the value of T

You might also like