plot.iqr: Plot Quantile Regression Coefficients

Description Usage Arguments Details Author(s) See Also Examples

View source: R/iqr2_auxfun.R

Description

Plots quantile regression coefficients β(p) as a function of p, based on a fitted model of class “iqr”.

Usage

1
2
## S3 method for class 'iqr'
plot(x, conf.int = TRUE, polygon = TRUE, which = NULL, ask = TRUE, ...)

Arguments

x

an object of class “iqr”, typically the result of a call to iqr.

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 polygon. Otherwise, dashed lines are used.

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 par.

Details

Using iqr, each quantile regression coefficient β(p) is described by a linear combination of known parametric functions of p. With this command, a plot of β(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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
  
  # 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

Example output

Loading required package: survival
Loading required package: pch

qrcm documentation built on Feb. 2, 2021, 9:07 a.m.