plot.grpreg {grpreg} | R Documentation |
Plot coefficients from a "grpreg" object
Description
Produces a plot of the coefficient paths for a fitted grpreg
object.
Usage
## S3 method for class 'grpreg'
plot(x, alpha=1, legend.loc, label=FALSE, log.l=FALSE,
norm=FALSE, ...)
Arguments
x |
Fitted |
alpha |
Controls alpha-blending. Default is alpha=1. |
legend.loc |
Where should the legend go? If left unspecified, no
legend is drawn. See |
label |
If TRUE, annotates the plot with text labels in the right margin describing which variable/group the corresponding line belongs to. |
log.l |
Should horizontal axis be on the log scale? Default is FALSE. |
norm |
If |
... |
Other graphical parameters to |
Author(s)
Patrick Breheny
See Also
grpreg
Examples
# Fit model to birthweight data
data(Birthwt)
X <- Birthwt$X
y <- Birthwt$bwt
group <- Birthwt$group
fit <- grpreg(X, y, group, penalty="grLasso")
# Plot (basic)
plot(fit)
# Plot group norms, with labels in right margin
plot(fit, norm=TRUE, label=TRUE)
# Plot (miscellaneous options)
myColors <- c("black", "red", "green", "blue", "yellow", "purple",
"orange", "brown")
plot(fit, legend.loc="topleft", col=myColors)
labs <- c("Mother's Age", "# Phys. visits", "Hypertension", "Mother's weight",
"# Premature", "Race", "Smoking", "Uterine irritability")
plot(fit, legend.loc="topleft", lwd=6, alpha=0.5, legend=labs)
plot(fit, norm=TRUE, legend.loc="topleft", lwd=6, alpha=0.5, legend=labs)
[Package grpreg version 3.4.0 Index]