Mqrcm (version 1.0)

plot.iMqr: Plot M-Quantile Regression Coefficients

Description

Plots M-quantile regression coefficients \(\beta(p)\) as a function of \(p\), based on a fitted model of class “iMqr”.

Usage

# S3 method for iMqr
plot(x, conf.int = TRUE, polygon = TRUE, which = NULL, ask = TRUE, …)

Arguments

x

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

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 iMqr, each M-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.

See Also

iMqr for model fitting; summary.iMqr and predict.iMqr for model summary and prediction.

Examples

Run this code
# NOT RUN {
  
# }
# NOT RUN {
  # using simulated data
  
  n <- 250
  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(iMqr(y ~ x, formula.p = ~ slp(p,3)), ask = FALSE) 
  # flexible fit with shifted Legendre polynomials
  
# }

Run the code above in your browser using DataCamp Workspace