diff options
| author | Gertjan van den Burg <gertjanvandenburg@gmail.com> | 2016-02-10 20:19:51 -0500 |
|---|---|---|
| committer | Gertjan van den Burg <gertjanvandenburg@gmail.com> | 2016-02-10 20:19:51 -0500 |
| commit | 6c3d2ff1cb9e7bd3bf1426e1ec4cecd0891ea089 (patch) | |
| tree | 0cf43714e1252ae833e473dc6beed6ddad953663 /R/plot.sparsestep.R | |
| parent | added authors and dependencies (diff) | |
| download | sparsestep-6c3d2ff1cb9e7bd3bf1426e1ec4cecd0891ea089.tar.gz sparsestep-6c3d2ff1cb9e7bd3bf1426e1ec4cecd0891ea089.zip | |
bugfixes, documentation improvements, and generic function agreement
Diffstat (limited to 'R/plot.sparsestep.R')
| -rw-r--r-- | R/plot.sparsestep.R | 24 |
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, ...) } |
