Learn R Programming

copula (version 0.999-7)

qqplot2: Q-Q Plot with Rugs and Pointwise Asymptotic Confidence Intervals

Description

A Q-Q plot (possibly) with rugs and pointwise approximate (via the Central Limit Theorem) two-sided 1-$\alpha$ confidence intervals.

Usage

qqplot2(x, qF, qqline.args = list(distribution=qF),
        rug.args = list(tcl=-0.6*par("tcl")),
        alpha = 0.05, CI.args = list(col="gray50"),
        CI.mtext = list(text=paste0("Pointwise asymptotic ", 100*(1-alpha),
                        "% confidence intervals"), side=4,
                        cex=0.6*par("cex.main"), adj=0, col="gray50"),
        main.args = list(text=expression(bold(italic(F)~~"Q-Q plot")),
                         side=3, line=1.1, cex=par("cex.main"),
                         font=par("font.main"), adj=par("adj"), xpd=NA),
        xlab = "Theoretical quantiles", ylab = "Sample quantiles", ...)

Arguments

qF
(theoretical) quantile function against which the Q-Q plot is created.
qqline.args
argument list passed to qqline() for creating the Q-Q line. Use qqline.args=NULL to omit the Q-Q line.
rug.args
argument list passed to rug() for creating the rugs. Use rug.args=NULL to omit the rugs.
alpha
significance level.
CI.args
argument list passed to lines() for plotting the confidence intervals. Use CI.args=NULL to omit the confidence intervals.
CI.mtext
argument list passed to mtext() for plotting information about the confidence intervals. Use CI.mtext=NULL to omit the information.
main.args
argument list passed to mtext() for plotting the title. Use main.args=NULL to omit the title.
xlab
x axis label.
ylab
y axis label.
...
additional arguments passed to plot() based for plotting the points.

Value

Details

See the source code for how the confidence intervals are constructed precisely.

See Also

plot() for the underlying plot function, qqline() for how the Q-Q line is implemented, rug() for how the rugs are constructed, lines() for how the confidence intervals are drawn, and mtext() for how the title and information about the confidence intervals is printed.

Examples

Run this code
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.args=list(text=as.expression(substitute(bold(italic(chi[nu])~~"Q-Q Plot"),
                       list(nu=df))), side=3, cex=1.3, line=1.1, xpd=NA))

## Q-Q plot against wrong quantiles (of an Exp(1) distribution)
qqplot2(x, qF=qexp,
        main.args=list(text=expression(bold(Exp(1)~~"Q-Q Plot")),
                       side=3, cex=1.3, line=1.1, xpd=NA))

Run the code above in your browser using DataLab