Exercises the coming week
Week 19
Exam 2021: Problems 1, 2 and 3.
Modified version of extra exercise 10: The purpose in this exercise is to reproduce Figures 8.6 and 8.8 of ISLR. The data set to be used in the analysis is the Heart data, store in the file Heart.csv in the data folder of the course. Here are the modified exercises:
a) Do as written in the exercise.
b) Reproduce Figure 8.6 of ISLR, but use r-code-week11.R from the lecture on March 25 as inspiration.
c) Do as written in the exercise, but to get the black curve, use mtry=p (i.e. do splits based on all covariates).
d) Do as written in the exercise, and additionally, you may also use r-code-week14.R from the lecture on April 9 as inspiration.
e) Add addtional curves to the plot, by also fitting gradient boosted trees, with possibly different tree sizes, using r-code-week13.R from the lecture on April 8 as inspiration. Here, you only need to compute the test error.
- Solution: extra_10.r
Exercises for past weeks
Week 18
Exercises from the book: 9.6 (in b only fit a tree). The ozone data are available here with some info here
- Solutions: esl_9_6.r
Exercises from ISLR: Exercise 8.4, 8.8a-c,e
- Solutions: islr_8_4.pdf and code examples in Chapter 8.3 Lab: Decision Trees in ISLR or https://rpubs.com/ppaquay/65564 (In 8.8b, use "
text(tree_model, pretty = 0, cex = 0.7)"for a nicer plot).
Exam 2019: Problem 2.
Week 15
Extra exercises 12 and 13. You find the zip_nn.R file with examples on the use of nnet() and mlp() on the 2022 page: /studier/emner/matnat/math/STK2100/v22/r-scripts/.
- Solutions: extra_12.r and extra_13.r.
Week 14
Exam STK2100 2019: Exercises 1a,d,e and 3
Exam STK2100 2022: Exercise 1 (in d you do not need to consider the three last methods in the table)
- Solutions: /studier/emner/matnat/math/STK2100/oppgaver
Week 13
Exercises from the book: 5.4 and 5.7
- Solutions: this solution manual, and/or Vera's notes: esl_5_4.pdf esl_5_7.pdf.
Exercises from ISLR: Exercise 7.1, 7.9
- Solutions: https://rpubs.com/lmorgan95/ISLR_CH7_Solutions. Note that there are some similarities between ISLR 7.1 and ESL Ex. 5.1 from week 11 and R-code-examples in ISLR Ch. 7.8 Lab: Non-linear Modeling.
Extra exercise 7
- Solutions: Vinnie's solution, pp. 22-27.
Week 11
Exercises from the book: 4.2 and 5.1
- Solutions: See this solution manual, on which Vera's notes from 2024 is based (esl_4_2a.pdf, esl_5_1.pdf).
Exercises from ISLR: 4.9 and 4.14 (a-f)
- Solutions: islr2_4_9.pdf and Chapter 4.7 Lab: Classification Methods in the ISLR book for R-code-examples similar to 4.14.
Exam STK2100 2018: Problem 2
- Solution: /studier/emner/matnat/math/STK2100/oppgaver/STK2100_2018_fasit.pdf (in Norwegian).
Extra exercise 6