if (FALSE) {
## --- Binomial example: simulate, fit, and plot --------------------------
set.seed(2025)
n <- 600
x1 <- rnorm(n); x2 <- rnorm(n); x3 <- rnorm(n)
eta <- -0.4 + 1.1*x1 - 0.8*x2 + 0.5*x3
p_true <- plogis(eta)
y <- rbinom(n, 1, p_true)
dat_b <- data.frame(y, x1, x2, x3)
fit_b <- SVEMnet(
y ~ x1 + x2 + x3 + I(x1^2) + (x1 + x2 + x3)^2,
data = dat_b,
family = "binomial",
glmnet_alpha = c(1, 0.5),
nBoot = 60,
objective = "auto",
weight_scheme = "SVEM",
relaxed = TRUE
)
# Calibration / ROC / PR
plot(fit_b, type = "calibration", bins = 12)
plot(fit_b, type = "roc")
plot(fit_b, type = "pr")
}
Run the code above in your browser using DataLab