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

Ch6>ex 10c 10d>The calculation of pred should include intercept #97

Open PhoebeDreamer opened 6 years ago

PhoebeDreamer commented 6 years ago

Hi, thanks for your amazing solutions.

I found that in problem 6.10, you didn't include the intercept when calculating pred by omitting the coefficient of intercept. Though the outputs are almost same, R^2 can be very different.

Reference: When is it ok to remove the intercept in a linear regression model? Removal of statistically significant intercept term increases R2 in linear model