aboutsummaryrefslogtreecommitdiff
path: root/R/plot.sparsestep.R
blob: 87ab661530d9c4d76e1269fdd19d452654eec2f8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#' @title Plot the SparseStep path
#'
#' @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 ... further argument to matplot
#'
#' @author
#' Gertjan van den Burg (author and maintainer).
#'
#' @export
#' @aliases plot
#'
#' @examples
#' data(diabetes)
#' attach(diabetes)
#' fit <- sparsestep(x, y)
#' plot(fit)
#' pth <- sparsestep.path(x, y)
#' plot(pth)
plot.sparsestep <- function(obj, type="s", lty=1, ...)
{
	index <- log(obj$lambda)
	coefs <- t(as.matrix(obj$beta))

	matplot(index, coefs, xlab="Log lambda", ylab="Coefficients",
	       	type=type, lty=lty, ...)
}