aboutsummaryrefslogtreecommitdiff
path: root/R/plot.sparsestep.R
diff options
context:
space:
mode:
Diffstat (limited to 'R/plot.sparsestep.R')
-rw-r--r--R/plot.sparsestep.R24
1 files changed, 11 insertions, 13 deletions
diff --git a/R/plot.sparsestep.R b/R/plot.sparsestep.R
index 87ab661..336a36b 100644
--- a/R/plot.sparsestep.R
+++ b/R/plot.sparsestep.R
@@ -2,29 +2,27 @@
#'
#' @description Plot the coefficients of the SparseStep path
#'
-#' @param obj a \code{sparsestep} object
-#' @param type the plot type, default: "s".
-#' @param lty line type, default: 1
+#' @param x a \code{sparsestep} object
#' @param ... further argument to matplot
#'
-#' @author
-#' Gertjan van den Burg (author and maintainer).
-#'
#' @export
#' @aliases plot
#'
#' @examples
-#' data(diabetes)
-#' attach(diabetes)
+#' x <- matrix(rnorm(100*20), 100, 20)
+#' y <- rnorm(100)
#' fit <- sparsestep(x, y)
#' plot(fit)
-#' pth <- sparsestep.path(x, y)
+#' pth <- path.sparsestep(x, y)
#' plot(pth)
-plot.sparsestep <- function(obj, type="s", lty=1, ...)
+plot.sparsestep <- function(x, ...)
{
- index <- log(obj$lambda)
- coefs <- t(as.matrix(obj$beta))
+ index <- log(x$lambda)
+ coefs <- t(as.matrix(x$beta))
+ dotlist <- list(...)
+ type <- ifelse(is.null(dotlist$type), "s", dotlist$type)
+ lty <- ifelse(is.null(dotlist$lty), 1, dotlist$lty)
matplot(index, coefs, xlab="Log lambda", ylab="Coefficients",
- type=type, lty=lty, ...)
+ type=type, lty=lty, ...)
}