plot,quadrupen-method {quadrupen} | R Documentation |
Plot method for a quadrupen object
Description
Produce a plot of the solution path of a quadrupen
fit.
Usage
\S4method{plot}{quadrupen}(x, y, xvar = "lambda",
main = paste(slot(x, "penalty")," path", sep=""),
log.scale = TRUE, standardize=TRUE, reverse=FALSE,
labels = NULL, plot = TRUE, ...)
Arguments
x |
output of a fitting procedure of the quadrupen
package ( |
y |
used for S4 compatibility. |
xvar |
variable to plot on the X-axis: either |
main |
the main title. Default is set to the model name followed by what is on the Y-axis. |
log.scale |
logical; indicates if a log-scale should be used
when |
standardize |
logical; standardize the coefficients before
plotting (with the norm of the predictor). Default is |
reverse |
logical; should the X-axis be reversed when
|
labels |
vector indicating the names associated to the plotted
variables. When specified, a legend is drawn in order to identify
each variable. Only relevant when the number of predictor is
small. Remind that the intercept does not count. Default is
|
plot |
logical; indicates if the graph should be plotted on
call. Default is |
... |
Not used |
Value
a ggplot2 object which can be plotted via the
print
method.
See Also
Examples
## Simulating multivariate Gaussian with blockwise correlation
## and piecewise constant vector of parameters
beta <- rep(c(0,1,0,-1,0), c(25,10,25,10,25))
cor <- 0.75
Soo <- toeplitz(cor^(0:(25-1))) ## Toeplitz correlation for irrelevant variables
Sww <- matrix(cor,10,10) ## bloc correlation between active variables
Sigma <- bdiag(Soo,Sww,Soo,Sww,Soo)
diag(Sigma) <- 1
n <- 50
x <- as.matrix(matrix(rnorm(95*n),n,95) %*% chol(Sigma))
y <- 10 + x %*% beta + rnorm(n,0,10)
## Plot the Lasso path
plot(elastic.net(x,y, lambda2=0), main="Lasso solution path")
## Plot the Elastic-net path
plot(elastic.net(x,y, lambda2=10), xvar = "lambda")
## Plot the Elastic-net path (fraction on X-axis, unstandardized coefficient)
plot(elastic.net(x,y, lambda2=10), standardize=FALSE, xvar="fraction")
## Plot the Bounded regression path (fraction on X-axis)
plot(bounded.reg(x,y, lambda2=10), xvar="fraction")