Chapter 6 Exercise 10a

Sign in to test your solution.
# a set.seed(1) x <- matrix(rnorm(1000 * 20), 1000, 20) b <- rnorm(20) b[3] <- 0 b[4] <- 0 b[9] <- 0 b[10] <- 0 b[19] <- 0 eps <- rnorm(1000) y <- x %*% b + eps # b train <- sample(seq(1000), 100, replace = FALSE) test <- -train x.train <- x[train, ] x.test <- x[test, ] y.train <- y[train] y.test <- y[test]
You can submit as many times as you like. Only your latest submission will be taken into account.
Sign in to test your solution.