Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

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

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

Multivariate Dependence with Copulas

v1.0-1
GPL (>= 3) | file LICENCE
Authors
Marius Hofert [aut] (<https://orcid.org/0000-0001-8009-4665>), Ivan Kojadinovic [aut] (<https://orcid.org/0000-0002-2903-1543>), Martin Maechler [aut, cre] (<https://orcid.org/0000-0002-8685-9910>), Jun Yan [aut] (<https://orcid.org/0000-0003-4401-7296>), Johanna G. Nešlehová [ctb] (evTestK(), <https://orcid.org/0000-0001-9634-4796>), Rebecca Morger [ctb] (fitCopula.ml(): code for free mixCopula weight parameters)
Initial release
2020-12-07

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.