- #An introduction to statistical learning exercises full
- #An introduction to statistical learning exercises code
# Number of Fisher Scoring iterations: 4 data % # Residual deviance: 1486.4 on 1082 degrees of freedom # Null deviance: 1496.2 on 1088 degrees of freedom # (Dispersion parameter for binomial family taken to be 1) This model is the logistic model in which we are regressing Direction as a function of all other variables except Today. #A first model We are going to adjust a first model to this data set. As expected, these correlation are near zero, the densities are centred at zero and they have low variance. The following matrix-plot produces scatter plots for each pair of variables, it adjusts a density estimation and calculates the correlations between pairs of variables.
We are looking to find a good predictive model. This data contains 1,089 weekly returns fro 21 years, from the beginning of 1990 to the end of 2010. Thanks to Iain Pardoe, Vladimir Vovk, Wei Jiang, Oscar Bonilla, Mette Langaas, Antoine Freches, Graeme Blackwood, and Adele Cutler.In this exercise we will study the Weekly data set, which is part of the ISLR library. , exercise 8 should refer to test MSE rather than test error rate. , figure 8.8: the colors for OOB: Bagging and OOB: RandomForest are interchanged in the legend. : “The generic plot() function recognizes that gam2 is an object of class gam," should read “The generic plot() function recognizes that gam.m3 is an object of class gam,” , Exercise 3 and 4: the sum of square terms should be squared.
: The parameter to control the number of folds in cv.glmnet() is "nfolds" not "folds". , scale invariant should be scale equivariant. : The equation Cp=sigma hat^2(Cp'+n) should be Cp=sigma hat^2/n(Cp'+n) Thanks to Ilya Kavalerov, Vladimir Vovk, Gongkai Li, Marisano James, Paulo Orenstein, Bob Stine, Thomas Lengauer and Scott Kaiser. , The text for exercise 6(b) should read "The researcher decides to replace the (j,i)th element of X with x_ where." An additional like should read "(The principal component analysis is performed on X^T)."
#An introduction to statistical learning exercises code
Correspondingly the 39% at the bottom of the page should be 10%. The R code on the website contains the corrected command. , The “newx=dat” in the R command at the bottom of the page is incorrect. , the caption for Figure 9.3 should read "The two blue points and the purple point that lie on the dashed lines are the support vectors, and the distance from those points to the hyperplane is indicated by arrows." Currently the text says margin rather than hyperplane. , Q9(b), should read “… Purchase as the response and the other variables as predictors….” , the first line after Figure 4.9 should be as follows "is some multiple of 1,275" (not 1,225). , Should read "For these data we don't expect this to be a problem, since p=2 and n=10,000," since p=2 not 3 or 4. , In Question 7 the reference to Section 3.3.3 should be to 3.3.2. , the caption to Figure 3.11 should read "Right: The response has been log transformed…". , line 16: The line starting “This estimate is known as the residual standard error …” should read “The estimate of $\sigma$ is known as the residual standard error …” , at the end of the last line it should read Fig 2.4 instead of Fig 2.3. Thanks to Poul Navin, David Dalpiaz, Jiao Wang, Hiroshi Ochiumi, Jayanth Raman. Hence, the x-axes on Figures 6.15 and 6.16 are not on the same scale. The principal components in Figure 6.16 were calculated after first standardizing both pop and ad, a common approach. Equation 6.3 should have a \hat \sigma^2 in the denominator with n, in the same way as for the equation above it for AIC.
#An introduction to statistical learning exercises full
After “…with each response measurement in (6.1).” Add “Typically \hat \sigma^2 is estimated using the full model containing all predictors.” The p-value for the Newspaper coefficient in Table 3.3 should be 0.00115. exercise 2(c), should read "interested in predicting" The code on the website has been updated accordingly. Predict(ridge.mod,s=0,exact=T,type="coefficients",x=x,y=y) Predict(ridge.mod,s=0,exact=T,type="coefficients") Ridge.pred=predict(ridge.mod,s=0,newx=x,exact=T) The glmnet package has been updated so two lines of code need to change.