• Wrong document? Swap it for free
  • Written by students who passed
  • Immediately available after payment
  • Read online or as PDF
Sell
Where do you study
Your language
Document preview thumbnail
Preview 2 out of 5 pages
Exam (elaborations)

Graphing Programming Assignment Comprehensive Study Guide + Exam Questions & Solutions Graded A+

Document preview thumbnail
Preview 2 out of 5 pages

Graphing Programming Assignment Comprehensive Study Guide + Exam Questions & Solutions Graded A+

Content preview

Graphing Programming Assignment
1. Find a dataset as you did in the previous assignment (can be the same dataset but
doesn't have to be). Divide it into test and training sets, and then create an Rpart model
on the training set to predict a dependent variable. For this part include just one column
to make the prediction from. (you are using one column to predict another). Include a
picture of the tree, along with 2 measures of error (root mean squared error and
absolute error) on the training and test set.

To check how well the regression tree worked, I used RMSE along with MAE across training
and test data. Training RMSE came out to 122.06 whereas test RMSE reached 123.26 - so
predictions miss actual values by roughly 122 to 123 calories per case. Looking at MAE, it's
96.41 on training but climbs slightly to 98.74 during testing, meaning most mistakes sit near 96–
99 calories. Because gap between training and test scores stays small, no signs point toward
overfitting right now.

, 2. Adjust the complexity parameter (make it lower) of the Rpart model until the training
accuracy stops going up. What is the test accuracy? If done correctly it should now be
lower since your model is overfit. Include the complexity parameter along with pictures
of the tree.

To check overfitting, I reduced the cp value in the rpart model. With cp = 0.001, the tree got
bigger, picking up more splits. Training RMSE dropped - from 122.06 in part 1 before to 113.22
while MAE went from 96.41 down to 88.35, meaning it matched training data closer. Test RMSE
decreased a bit too, falling from 123.26 to 116.27; MAE followed suit, sliding from 98.74 to
91.88. This shows the model is starting to overfit, and lowering cp further would eventually
cause the test error to increase while the training error continues to decrease.

Document information

Uploaded on
April 4, 2026
Number of pages
5
Written in
2025/2026
Type
Exam (elaborations)
Contains
Questions & answers
$16.99

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Seller avatar
Reputation scores are based on the amount of documents a seller has sold for a fee and the reviews they have received for those documents. There are three levels: Bronze, Silver and Gold. The better the reputation, the more your can rely on the quality of the sellers work.
YourExamplug
4.1
(74)
Sold
226
Followers
27
Items
18088
Last sold
2 weeks ago



Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions