asadoughi / stat-learning

Notes and exercise attempts for "An Introduction to Statistical Learning"
http://asadoughi.github.io/stat-learning
2.12k stars 1.62k forks source link

Chapter 10 Question 7 #108

Open s17k opened 4 years ago

s17k commented 4 years ago

The solution is obviously wrong because the check at the end fails (there should be no variability in this ratio). The reason is that "scale" in R standardizes columns, not rows (which is counter-intuitive, but they do tell us to make sure that the sd of each observation, not variable is 1). This can be solved by running dsc = t(scale(t(USArrests))) instead of dsc = scale(USArrests)

leowang396 commented 3 years ago

agreed