View source: R/plot.genlasso.R
plot.genlasso | R Documentation |
The function plot.genlasso
produces a plot of the coordinate
paths for objects of class "genlasso". This can be helpful for
visualizing the full solution path for small problems; however, for
moderate or large problems, the plot produced can be quite dense and
difficult to interpret. The function plot.trendfilter
applies
to objects of class "trendfilter", and plots trend filtering
coefficients at a single value of lambda (or multiple
values, as specified by the user) as a function of the input positions
(which, recall, are assumed to be evenly spaced if not specified).
The function plot.cv.trendfilter
plots the output of
cv.trendfilter
.
## S3 method for class 'genlasso' plot(x, type = c("primal", "dual", "both"), numbers = FALSE, vlines = TRUE, xlab, ylab, ...) ## S3 method for class 'trendfilter' plot(x, style = c("trend", "path"), lambda, nlam, df, xlab, ylab, ...) ## S3 method for class 'cv.trendfilter' plot(x, legendpos = "top", xlab, ylab, ...)
x |
an object of the appropriate class ("genlasso" or anything class
inherits this for |
type |
for |
numbers |
for |
vlines |
for |
style |
for |
lambda, nlam, df |
for |
legendpos |
for |
xlab |
an optional character string label for the x-axis. |
ylab |
an optional character string label for the y-axis. |
... |
additional arguments. |
For plot.trendfilter
, with style
set to "trend", a
coefficient object is silently returned as specified by lambda
,
nlam
, or df
.
genlasso
, trendfilter
,
cv.trendfilter
# Constant trend filtering (the 1d fused lasso) set.seed(0) n = 100 beta0 = rep(sample(1:10,5),each=n/5) y = beta0 + rnorm(n,sd=0.8) a = fusedlasso1d(y) cv = cv.trendfilter(a) plot(a,style="path") plot(cv) plot(a,lambda=cv$lambda.1se)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.