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

View source: R/graphics.R

qqplot2R Documentation

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, 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, ...)

Arguments

x

numeric.

qF

(theoretical) quantile function against which the Q-Q plot is created.

log

character string indicating whether log-scale should be used; see ?plot.default.

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

title (can be an expression; use "" for no title).

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.

file

file name including the extension “.pdf”.

width

width parameter of pdf().

height

height parameter of pdf().

...

additional arguments passed to plot() based for plotting the points.

Details

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

Value

invisible().

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. pdf() for plotting to pdf.

Examples

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")))

copula documentation built on Sept. 11, 2024, 7:48 p.m.