###########################
# Logistic regression model
set.seed(123)
n <- 100
p <- 10
X <- matrix(rnorm(n*p), n, p)
b <- 1:2
eta <- b[1] + X[,1] * b[2]
mu <- binomial()$linkinv(eta)
y <- rbinom(n, 1, mu)
fit_pc <- dglars.fit(X, y, family = "binomial")
par(mfrow = c(2, 3))
plot(fit_pc, k = "BIC", complexity = "df")
plot(fit_pc, k = "AIC", complexity = "df")
fit_ccd <- dglars.fit(X, y, family = "binomial",
control = list(algorithm = "ccd"))
par(mfrow = c(2, 2))
plot(fit_ccd, k = "BIC", complexity = "df")
plot(fit_ccd, k = "AIC", complexity = "df")Run the code above in your browser using DataLab