stat-learning icon indicating copy to clipboard operation
stat-learning copied to clipboard

Notes and exercise attempts for "An Introduction to Statistical Learning"

Results 53 stat-learning issues
Sort by recently updated
recently updated
newest added

I believe the solutions are all shifted 1 degree of freedom. For a) the function should be 0 everywhere, otherwise the regularization term is infinity, for b) the first dericative...

Why is (3,4,6,8) clustered and not (3,4,5,6) or (2) and (1,3,4,5,6,7,8)? Because these are closest to each other and have the least socks and computers?

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...

It is not mentioned in the task statement explicitly, but I think it is implied that mpg should be excluded as a predictor. The solution proposed here uses mpg as...

In R version 4.0.2, excluding the `stringsAsFactors=TRUE` parameter causes errors in subsequent calls to `pairs` and `plot`. Fixes issues #106 and #111.

set.seed(1) p=100 n=1000 max.rep=1000 x=matrix(ncol=p,nrow=n) coefi=rep(NA,p) for (i in 1:p){ x[,i]=rnorm(n) coefi[i]=rnorm(1)*100 } y=x%*%coefi+rnorm(n) beta=rep(0,p) error=rep(0,max.rep) for (j in 1:max.rep){ for (i in 1:p){ a=y-x%*%beta+beta[i]*x[,i] beta[i]=lm(a~x[,i])$coef[2] } error[j]=sum((y-x%*%beta)^2) } error...

I agree with the intuition of the argument, but it is not necessarily true that each iteration will produce a split of an unused variable. I.e. if variable X(1) is...

In the proposed answer to part a, **0.2 standard deviation** of optimum is used to demarcate the range of acceptable evaluation metrics. Is there any evidence to support **why 0.2**?...

1. First, bs(4) should have only *ONE* knot; 2. Second, it seems like when adding both df and knot in bs(), the result is not just ignoring knot.