plot.piqr: Plot a Penalized QRCM

View source: R/piqr-methods.R

plot.piqrR Documentation

Plot a Penalized QRCM

Description

Coefficient paths, gradient paths and estimated coefficient functions \hat\beta(p) of a piqr() fit.

Usage

## S3 method for class 'piqr'
plot(
  x,
  xvar = c("lambda", "objective", "grad", "beta"),
  pos.lambda,
  label = FALSE,
  which = NULL,
  ask = interactive(),
  polygon = TRUE,
  ...
)

Arguments

x

an object of class "piqr".

xvar

what to plot: "lambda" (coefficient paths against \log\lambda), "objective" (coefficient paths against the minimized loss), "grad" (\ell_1-norm of the gradient of each covariate against \log\lambda), or "beta" (the coefficient functions \hat\beta_j(p) at pos.lambda).

pos.lambda

the position of the selected \lambda (for xvar = "beta").

label

logical: label the curves (paths only)?

which

for xvar = "beta", an optional vector of indices of the coefficients to plot. If missing and ask = TRUE, a menu is shown.

ask

logical: for xvar = "beta", choose interactively which coefficient to plot? Defaults to interactive().

polygon

logical: for xvar = "beta" with standard errors, draw confidence bands as shaded areas?

...

additional graphical parameters (xlab, ylab, col, lwd, xlim, ylim, main, ...).

Value

No return value, called for its side effects.

See Also

piqr()

Examples

set.seed(1)
n <- 200
x1 <- runif(n); x2 <- runif(n); x3 <- runif(n)
y <- 1 + qnorm(runif(n)) + 2 * x1 - x2
fit <- piqr(y ~ x1 + x2 + x3, formula.p = ~ slp(p, 2), nlambda = 20)
oldpar <- par(mfrow = c(1, 2))
plot(fit, xvar = "lambda")
plot(fit, xvar = "grad")
par(oldpar)
plot(fit, xvar = "beta", pos.lambda = 20, which = 2)

qrcmNP documentation built on Oct. 30, 2026, 5:10 p.m.