# R/plot.cv.gcdnet.R In gcdnet: LASSO and Elastic Net (Adaptive) Penalized Least Squares, Logistic Regression, HHSVM, Squared Hinge SVM and Expectile Regression using a Fast GCD Algorithm

```######################################################################
## This function is adapted/modified based on the plot.cv
#   function from
## the glmnet package:
## Jerome Friedman, Trevor Hastie, Robert Tibshirani
#   (2010).
## Regularization Paths for Generalized Linear Models via
#   Coordinate Descent.
##        Journal of Statistical Software, 33(1), 1-22.
##        URL http://www.jstatsoft.org/v33/i01/.

plot.cv.gcdnet <- function(x, sign.lambda = 1, ...) {
cvobj <- x
xlab <- "log(Lambda)"
if (sign.lambda < 0)
xlab <- paste("-", xlab, sep = "")
plot.args <- list(x = sign.lambda * log(cvobj\$lambda), y = cvobj\$cvm,
ylim = range(cvobj\$cvupper, cvobj\$cvlo), xlab = xlab,
ylab = cvobj\$name, type = "n")
new.args <- list(...)
if (length(new.args))
plot.args[names(new.args)] <- new.args
do.call("plot", plot.args)
error.bars(sign.lambda * log(cvobj\$lambda), cvobj\$cvupper,
cvobj\$cvlo, width = 0.01, col = "darkgrey")
points(sign.lambda * log(cvobj\$lambda), cvobj\$cvm, pch = 20,
col = "red")
axis(side = 3, at = sign.lambda * log(cvobj\$lambda), labels = paste(cvobj\$nz),
tick = FALSE, line = 0)
abline(v = sign.lambda * log(cvobj\$lambda.min), lty = 3)
abline(v = sign.lambda * log(cvobj\$lambda.1se), lty = 3)
invisible()
}
```

## Try the gcdnet package in your browser

Any scripts or data that you put into this service are public.

gcdnet documentation built on May 2, 2019, 5:42 a.m.