Q-Q Plot with Rugs and Pointwise Asymptotic Confidence Intervals
A Q-Q plot (possibly) with rugs and pointwise approximate (via the Central Limit Theorem) two-sided 1-alpha confidence intervals.
qqplot2(x, qF, log = "", qqline.args = if(log=="x" || log=="y")
list(untf=TRUE) else list(),
rug.args = list(tcl=-0.6*par("tcl")),
alpha = 0.05, CI.args = list(col="gray40"),
CI.mtext = list(text=paste0("Pointwise asymptotic ", 100*(1-alpha),
"% confidence intervals"), side=4,
cex=0.6*par("cex.main"), adj=0, col="gray40"),
main = quote(bold(italic(F)~~"Q-Q plot")),
main.args = list(text=main, side=3, line=1.1, cex=par("cex.main"),
font=par("font.main"), adj=par("adj"), xpd=NA),
xlab = "Theoretical quantiles", ylab = "Sample quantiles",
file="", width=6, height=6, ...)x |
|
qF |
(theoretical) quantile function against which the Q-Q plot is created. |
log |
|
qqline.args |
argument |
rug.args |
argument |
alpha |
significance level. |
CI.args |
argument |
CI.mtext |
argument |
main |
title (can be an expression; use "" for no title). |
main.args |
argument |
xlab |
x axis label. |
ylab |
y axis label. |
file |
file name including the extension “.pdf”. |
width |
width parameter of |
height |
height parameter of |
... |
additional arguments passed to |
See the source code for how the confidence intervals are constructed precisely.
invisible().
n <- 250
df <- 7
set.seed(1)
x <- rchisq(n, df=df)
## Q-Q plot against the true quantiles (of a chi^2_3 distribution)
qqplot2(x, qF = function(p) qchisq(p, df=df),
main = substitute(bold(italic(chi[NU])~~"Q-Q Plot"), list(NU=df)))
## in log-log scale
qqplot2(x, qF = function(p) qchisq(p, df=df), log="xy",
main = substitute(bold(italic(chi[NU])~~"Q-Q Plot"), list(NU=df)))
## Q-Q plot against wrong quantiles (of an Exp(1) distribution)
qqplot2(x, qF=qexp, main = quote(bold(Exp(1)~~"Q-Q Plot")))Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.