plot.piqr {qrcmNP} | R Documentation |
Plot Penalized Quantile Regression Coefficients
Description
Produces a coefficient profile plot of the quantile
regression coefficient paths for a fitted model of
class “piqr
”.
Usage
## S3 method for class 'piqr'
plot(x, xvar=c("lambda", "objective", "grad", "beta"), pos.lambda,
label=FALSE, which=NULL, ask=TRUE, polygon=TRUE, ...)
Arguments
x |
an object of class “ |
xvar |
What is on the X-axis. "lambda" against the log-lambda sequence, "objective" against the value
of the minimized integrated loss function and "grad" the log-lambda sequence
against the gradient.
xvar = "beta" needs a lambda value to plot quantile regression coefficients
|
pos.lambda |
the position of a lambda in the sequence of the object of class “ |
label |
If TRUE, label the curves with variable sequence numbers. |
which |
an optional numerical vector indicating which coefficient(s) to plot. If which = NULL, all coefficients are plotted. |
ask |
logical. If which = NULL and ask = TRUE (the default), you will be asked interactively which coefficients to plot. |
polygon |
ogical. If TRUE, confidence intervals are represented by shaded areas via polygon. Otherwise, dashed lines are used. |
... |
additional graphical parameters, that can include xlim, ylim, xlab, ylab, col, lwd.
See |
Details
A coefficient profile plot is produced.
Author(s)
Gianluca Sottile gianluca.sottile@unipa.ot
See Also
piqr
for model fitting; gof.piqr
for the model selection criteria; summary.piqr
and predict.piqr
for model summary and prediction.
Examples
# using simulated data
n <- 300
x <- runif(n)
qy <- function(p,x){p^2 + x*log(p)}
# true quantile function: Q(p | x) = beta0(p) + beta1(p)*x, with
# beta0(p) = p^2
# beta1(p) = log(p)
y <- qy(runif(n), x) # to generate y, plug uniform p in qy(p,x)
obj <- piqr(y ~ x, formula.p = ~ slp(p,3), nlambda=50)
best <- gof.piqr(obj, method="BIC", plot=FALSE)
par(mfrow = c(1,3))
plot(obj, xvar="lambda")
plot(obj, xvar="objective")
plot(obj, xvar="grad")
par(mfrow=c(1,2));plot(obj, xvar="beta", pos.lambda=best$posMinLambda, ask=FALSE)
# flexible fit with shifted Legendre polynomials