Norwegian version of this page

Exercises

Here, weekly exercises will be given. These will normally be published after the lectures on thursdays. 

Note that the link to book website given in the book do not work any more, new link is https://hastie.su.domains/ElemStatLearn/

A link to the extra exercises is here.

Some solution proposals are posted below and here (and from last year).

  • Exercises for May 8:
  • Exercises for May 4 (will be discussed on Tuesday May 9):
  • Exercises for April 24:
    • From the textbook: Exercise 9.6 (in b only fit a tree) 
      • The ozone data are available here with some info here.
      • There was a typo on that ex 9.8 was listed, but it should have been 9.6.
    • From the ISLR book: Exercise 8.4, 8.8a-c (Solutions. In 8.8b, use  "text(tree_model, pretty = 0, cex = 0.7)" for a nicer plot)
    • Exam 2022: Problem 3 (Solution)
      • The ROC curve we have not discussed in the lectures but are described on page 314-317 in the textbook. Read this as part of the exercise. The main message though is that the area under the curve should be as large as possible. Note also that the x-axis in the exercise is flipped compared with Figure 9.6 in the textbook.
  •  Exercises for April 17:
    • Exam STK2100 2019: Exercises 1 (not b or c), 3. (Solution)
    • Exam STK2100 2022: Exercise 1 (in d you do not need to consider the three last methods in the table), 2. (Solution)
  • Exercises for April 13 (Note the day!)
    • Extra exercises 12 and 13 (Solution)
      • We skip exercise 12 since this exercise is partly included in the compulsory exercise.
  • Exercises for March 27:
  • Exercises for March 13
  • Exercises for March 6
  • Exercises for February 27:
  • Exercises for February 20:
  • Exercises for February 13:
  • Exercises for February 6:
    • Extra exercises 2 and 3 (2 is mainly what we went through at the lecture, but try yourself!) (Vinnie's solutions)
    • Extra exercise 1 (This exercise is mainly a preparation for the topic that we will discuss at the lecture on Tuesday, but it will be very helpful to try to work on this in front). (Geir's solution and Vinnie's solution)
    • From the ISLR book (James et al): Exercise 3.8, 3.5 (3.5 is a simplified version of extra exercise 1, perhaps easier to try this before that one) (See e.g. Vinnie's solutionsthis solution, or this solution).
  • Exercises for January 30:
    • Exercise 2.7 from the textbook. (Solution, pp. 8-9, many small typos, unfortunately. In a), note that \hat{f}(x_0) = x_0^T(X^TX)^{-1}X^TY, and not \hat{f}(x_0) = x_0^TX(X^TX)^{-1}X^TY, and missing y_i in KNN. Should be E_{Y|X}[\hat{f}(x_0)] and not E_{Y|X}[f(x_0)] in b). Same when doing E_{Y, X} in c).)
    • Exercises 1, 2, and 8 from chapter 2 of the ISLR book (James et al), see webpage for the book for downloading data. (Solution)
      • Regarding exercise 8: The easiest way of getting hold of the data is to install the ISLR library (through the command install.packages("ISLR")), make the library available (through the library("ISLR")), and then make the data available through data(College)
Published Jan. 24, 2023 10:03 AM - Last modified Jan. 29, 2024 10:54 AM