Learn R Programming

hqreg (version 1.2)

plot.hqreg: Plot coefficients from a "hqreg" object

Description

Produce a plot of the coefficient paths for a fitted "hqreg" object.

Usage

## S3 method for class 'hqreg':
plot(x, xvar = c("lambda", "norm"), log.x=FALSE, nvars = TRUE, 
    alpha = 1, ...)

Arguments

x
A hqreg object.
xvar
What is on the X-axis. "lambda" plots against the lambda sequence, "norm" against the L1-norm of the coefficients.
log.x
Should X-axis be on the log scale? Default is FALSE. Must set log.x to be FALSE for xvar = "norm" since the norm can be exactly 0.
nvars
If TRUE (the default), places an axis on top of the plot denoting the number of variables with nonzero coefficients at each lambda.
alpha
A value between 0 and 1 for alpha transparency channel(0 means transparent and 1 means opaque), helpful when the number of variables is large.
...
Other graphical parameters to plot.

See Also

hqreg

Examples

Run this code
X = matrix(rnorm(1000*100), 1000, 100)
beta = rnorm(10)
eps = 4*rnorm(1000)
y = drop(X[,1:10] %*% beta + eps) 
fit = hqreg(X, y)
par(mfrow = c(2,2))
plot(fit)
plot(fit, nvars = FALSE, alpha = 0.5)
plot(fit, log.x = TRUE)
plot(fit, xvar = "norm")

Run the code above in your browser using DataLab