View source: R/plot_par_welnet.R
| plot.par.w.elnet | R Documentation |
par.w.elnet objectsA plot method to visualize the results of par_wElnet(): the weighted
error curve across the lambda grid for each alpha, and/or a
summary of the best (minimum) error achieved by each alpha,
with the overall best (alpha, lambda) combination highlighted.
For the single-alpha output of \code{\link{wElnet}} itself, see
[plot.w.elnet()].
## S3 method for class 'par.w.elnet'
plot(
x,
type = c("both", "profile", "summary"),
log.lambda = TRUE,
legend.pos = "topright",
palette = NULL,
main.profile = NULL,
xlab.profile = NULL,
ylab.profile = NULL,
main.summary = NULL,
xlab.summary = NULL,
ylab.summary = NULL,
...
)
x |
An object of class |
type |
A string indicating what to plot. One of:
|
log.lambda |
A logical value. If |
legend.pos |
A string passed to |
palette |
A vector of colors to cycle through for the different alphas in the
|
main.profile, xlab.profile, ylab.profile |
Optional strings overriding the title
and axis labels of the |
main.summary, xlab.summary, ylab.summary |
Optional strings overriding the title
and axis labels of the |
... |
Additional graphical parameters (e.g. |
Invisibly returns x. Called for its side effect of producing a plot.
library(MLSurvey)
data(nhanes2013_sbc)
alpha <- c(0.000, 0.001, 0.008, 0.027, 0.064, 0.125, 0.216, 0.343, 0.512, 0.729, 1.000)
en.par <- par_wElnet(alpha = alpha,
data = nhanes2013_sbc,
col.y = "HBP", col.x = 2:61,
family = "binomial",
cluster = "SDMVPSU", strata = "SDMVSTRA", weights = "WTSAF2YR",
method = "dCV", k = 10, R = 20)
plot(en.par) # both panels
plot(en.par, type = "profile") # just the error-vs-lambda curves
plot(en.par, type = "summary") # just the best-error-vs-alpha curve
plot(en.par, type = "profile", main.profile = "My custom title", xlab.profile = "Penalty")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.