library(glmnet)
library(caret)
library(tidyverse)
library(ggplot2)
library(purrr)
# Simulasi data
set.seed(2024)
n <- 100
p <- 500
X <- matrix(rnorm(n * p), nrow = n, ncol = p)
true_beta <- rep(0, p)
true_beta[1:10] <- c(1, -1, 2, -2, 1.5, -1.5, 0.5, -0.5, 2, -2)
y <- X %*% true_beta + rnorm(n, sd = 2)