Quadrupen does not behave as expected in the following sequence :
fit <- elastic.net(x = 0 + Xp, y = Yp, lambda2 = 0, penscale = penscale)
df <- rowSums(fit@active.set)
Result : df = [0, ..., 49, 53, ...]
find df closest to K=50 from below (K_inf < K) and above (K_sup > K) and lambdas corresponding :
lambda_inf <- fit@lambda1[tail(which(K_inf == df), n=1)]
lambda_sup <- fit@lambda1[head(which(K_sup == df), n=1)]
Do a new fit in hope that K will appear in df, using the lambdas found above :
lambda <- seq(from = lambda_inf, to = lambda_sup, length.out = 100)
fit <-elastic.net(x = 0 + Xp, y = Yp, lambda1 = lambda, lambda2 = 0, penscale = penscale)
df <- rowSums(fit@active.set)
Result : df = [43, ..., 43]
Quadrupen does not behave as expected in the following sequence :