Need help with your Discussion

Get a timely done, PLAGIARISM-FREE paper
from our highly-qualified writers!

glass
pen
clip
papers
heaphones

Create a Training Set Containing a Random Sample of Observations R Coding Task

Create a Training Set Containing a Random Sample of Observations R Coding Task

Create a Training Set Containing a Random Sample of Observations R Coding Task

Description

Problem1

Recall the dataset tumor.csv used in previous homework assignments. As a reminder, you
may need to change certain variables to factors.
a) Create a training set containing a random sample of 90% observations, and a test set
containing the remaining 10% of the observations. Remember to set the seed to 1
for consistent results.
b) Fit a tree to the training data, with Diagnosis as the response and the other
variables as predictors. Use the summary() function to produce summary statistics
for the tree, and describe the results obtained. What is the training error rate? How
many terminal nodes does the tree have?
c) Type in the name of the tree object in order to get a detailed text output. Pick one of
the terminal nodes, and interpret the information displayed.
d) Create a plot of the tree, and interpret the results.
e) Predict the response on the test data, and produce a confusion matrix comparing the
test labels to the predicted test labels. What is the test error rate?
f) Apply the cv.tree() function to the training set in order to determine the optimal
tree size.
g) Produce a plot with tree size on the -axis and cross-validated classification error
rate on the -axis.
h) Produce a pruned tree corresponding to the optimal tree size obtained using cross-
validation. If cross-validation does not lead to selection of a pruned tree, then create
a pruned tree with five terminal nodes.
i) Compare the training error rates between the pruned and unpruned trees. Which is
higher?

j) Compare the test error rates between the pruned and unpruned trees. Which is
higher?
k) Now apply bagging to the training set. What is the test misclassification rate for this
result?
l) Perform boosting on the training set with 1,000 trees for a range of values of the
shrinkage parameter . Produce a plot with different shrinkage values on the -axis
and the corresponding training misclassification rate on the -axis. Use 0.5 as the
cut point for classification of Benign and Malignant.
m) Produce a plot with different shrinkage values on the -axis and the corresponding
test misclassification rate on the -axis.
n) Use random forests to analyze this data. What test misclassification rate do you
obtain (again, use 0.5 to classify either Malignant or Benign)? Use the importance()
function to determine which variables are most important. Describe the effect of ,
the number of variables considered at each split, on the error rate obtained.

Have a similar assignment? "Place an order for your assignment and have exceptional work written by our team of experts, guaranteeing you A results."

Order Solution Now

Our Service Charter


1. Professional & Expert Writers: Eminence Papers only hires the best. Our writers are specially selected and recruited, after which they undergo further training to perfect their skills for specialization purposes. Moreover, our writers are holders of masters and Ph.D. degrees. They have impressive academic records, besides being native English speakers.

2. Top Quality Papers: Our customers are always guaranteed of papers that exceed their expectations. All our writers have +5 years of experience. This implies that all papers are written by individuals who are experts in their fields. In addition, the quality team reviews all the papers before sending them to the customers.

3. Plagiarism-Free Papers: All papers provided by Eminence Papers are written from scratch. Appropriate referencing and citation of key information are followed. Plagiarism checkers are used by the Quality assurance team and our editors just to double-check that there are no instances of plagiarism.

4. Timely Delivery: Time wasted is equivalent to a failed dedication and commitment. Eminence Papers are known for the timely delivery of any pending customer orders. Customers are well informed of the progress of their papers to ensure they keep track of what the writer is providing before the final draft is sent for grading.

5. Affordable Prices: Our prices are fairly structured to fit in all groups. Any customer willing to place their assignments with us can do so at very affordable prices. In addition, our customers enjoy regular discounts and bonuses.

6. 24/7 Customer Support: At Eminence Papers, we have put in place a team of experts who answer all customer inquiries promptly. The best part is the ever-availability of the team. Customers can make inquiries anytime.

We Can Write It for You! Enjoy 20% OFF on This Order. Use Code SAVE20

Stuck with your Assignment?

Enjoy 20% OFF Today
Use code SAVE20