From 6c3d2ff1cb9e7bd3bf1426e1ec4cecd0891ea089 Mon Sep 17 00:00:00 2001 From: Gertjan van den Burg Date: Wed, 10 Feb 2016 20:19:51 -0500 Subject: bugfixes, documentation improvements, and generic function agreement --- R/plot.sparsestep.R | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) (limited to 'R/plot.sparsestep.R') 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, ...) } -- cgit v1.2.3