plot.iqr {qrcm} | R Documentation |
Plot Quantile Regression Coefficients
Description
Plots quantile regression coefficients
\beta(p)
as a function of p
,
based on a fitted model of class “iqr
”.
Usage
## S3 method for class 'iqr'
plot(x, conf.int = TRUE, polygon = TRUE, which = NULL, ask = TRUE, ...)
Arguments
x |
an object of class “ |
conf.int |
logical. If TRUE, asymptotic 95% confidence intervals are added to the plot. |
polygon |
logical. If TRUE, confidence intervals are represented by shaded areas via |
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. |
... |
additional graphical parameters, that can include xlim, ylim, xlab, ylab, col, lwd, cex.lab, cex.axis, axes, frame.plot.
See |
Details
Using iqr
, each quantile regression coefficient \beta(p)
is described by a linear
combination of known parametric functions of p
. With this command, a plot of
\beta(p)
versus p
is created. If ask = TRUE, an additional option permits
plotting a Q-Q plot of the fitted cumulative distribution function (CDF), that should follow
a U(0,1) distribution if the model is correctly specified. If the data are censored or truncated,
this is assessed applying the Kaplan-Meier estimator to the fitted CDF values.
See also test.fit
for a formal test of uniformity.
Author(s)
Paolo Frumento paolo.frumento@unipi.it
See Also
iqr
for model fitting; summary.iqr
and predict.iqr
for model summary and prediction.
Examples
# using simulated data
n <- 1000
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)
par(mfrow = c(1,2))
plot(iqr(y ~ x, formula.p = ~ slp(p,3)), ask = FALSE)
# flexible fit with shifted Legendre polynomials