plot.w.elnet: Plot method for 'w.elnet' objects (single-alpha 'wElnet()'...

View source: R/plot_par_welnet.R

plot.w.elnetR Documentation

Plot method for w.elnet objects (single-alpha wElnet() output)

Description

A method to visualize the weighted error curve across the lambda grid for a single wElnet fit (i.e. a single, fixed alpha), marking the selected lambda.min. This is the single-alpha counterpart to plot.par.w.elnet(), which handles the multi-alpha output of par_wElnet().

Usage

## S3 method for class 'w.elnet'
plot(x, log.lambda = TRUE, main = NULL, xlab = NULL, ylab = NULL, ...)

Arguments

x

An object of class w.elnet, the output of wElnet.

log.lambda

A logical value. If TRUE (default), the x-axis is log(lambda), matching glmnet convention. If FALSE, lambda is plotted on its original scale.

main, xlab, ylab

Optional strings overriding the plot title and axis labels. If NULL (default), sensible defaults are used ("Error profile (alpha = ...)", "log(lambda)" or "lambda", and "Weighted error").

...

Additional graphical parameters (e.g. col, lwd, lty) passed to the underlying plot() call. Do not pass main, xlab, or ylab here – use the dedicated arguments above instead.

Value

Invisibly returns x. Called for its side effect of producing a plot.

Examples


library(MLSurvey)
data(nhanes2013_sbc)

en.dcv <- wElnet(data = nhanes2013_sbc,
                 col.y = "HBP", col.x = 2:61,
                 family = "binomial", alpha = 0.729,
                 cluster = "SDMVPSU", strata = "SDMVSTRA", weights = "WTSAF2YR",
                 method = "dCV", k = 10, R = 20)

plot(en.dcv)
plot(en.dcv, main = "My custom title", xlab = "Penalty", ylab = "Error")



MLSurvey documentation built on Nov. 18, 2026, 5:11 p.m.