MATH 456 Homework 09, help

  1. Use the library glmnet to fit a cross-validated regularized family = multinomial model model that predicts which island each penguin is from.

To help you get started on 1., here's the some pseudocode to set up the problem.

df$i <- factor(df$island, labels = c("Biscoe", "Dream", "Torgersen"))
mf <- model.frame(i ~ x, data = df) # x represents arbitrary explanatory variables
X <- model.matrix(mf, data = df)
y <- model.response(mf)