qqplotFast: Fast QQ-plot for Large Number of P-values

Description Usage Arguments Details Value Note Note Author(s) See Also Examples

Description

Function qqPlotFast creates a QQ-plot with a confidence band and an estimate of inflation factor lambda. It optimized to work quickly even for tens of millions of p-values.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
qqPlotPrepare(
        pvalues,
        ntests = NULL,
        ismlog10 = FALSE)
qqPlotFast(
        x, 
        ntests = NULL, 
        ismlog10 = FALSE, 
        ci.level = 0.05, 
        ylim = NULL, 
        newplot = TRUE, 
        col = "#D94D4C", 
        cex = 0.5, 
        yaxmax = NULL, 
        lwd = 3, 
        axistep = 2, 
        col.band = "#ECA538",
        makelegend = TRUE,
        xlab = expression(
            paste("\u2013", " log"[10]*"(", italic("P"), "), null")),
        ylab = expression(
            paste("\u2013", " log"[10]*"(", italic("P"), "), observed")))

Arguments

pvalues

Vector of p-values. As is (if ismlog10 = FALSE) or minus log10 transformed (if ismlog10 = TRUE).

ntests

If only significant p-values are provided, the total number of tests performed.
By default ntests is equal to the length of pvalues.

ismlog10

Specifies whether the provides p-values (pvalues parameter) are minus log10 transformed (- log10(pv))

x

Either a vector of p-values, as in qqPlotPrepare, or the object returned by qqPlotPrepare.

ci.level

Significance level of the confidence band. Set to NULL avoid plotting the confidence band.

ylim

Numeric vectors of length 2, giving the y coordinate range. Exactly as in Plotting Parameters.

newplot

If TRUE, the function creates a new plot window.

col

The QQ-plot curve color.

col.band

Confidence band curve color.

cex

The size of QQ-plot points. As in Graphics Parameters.

lwd

The line width.
As in Graphics Parameters.

axistep

Distance between axis label ticks for both axis.

yaxmax

Maximum reach of the y axis.

makelegend

If true, add legend to the plot.

xlab, ylab

Axis labels. As in plot function.

Details

The function qqPlotFast creates a QQ-plot.
The function qqPlotPrepare extracts the necessary information from a vector of p-values sufficient for creating QQ-plot.
The resulting object is many times smaller than the vector of p-values.

Value

The function qqPlotPrepare returns an object with the necessary information from a vector of p-values sufficient for creating QQ-plot.

Note

The plot has no title. To add a title use title.

Note

The function works faster if the p-values are sorted.

Author(s)

Andrey A Shabalin andrey.shabalin@gmail.com

See Also

See vignettes: browseVignettes("ramwas").

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# Million p-values
n = 1e6

# Null p-values
pv = runif(n)

# QQ-plot should be nearly diagonal
qqPlotFast(pv)
title("QQ-plot")

# Size of p-values before extraction of QQ-plot info
object.size(pv)

# Extract the QQ-plot info
qq = qqPlotPrepare(pv)

# Size of the QQ-plot info object
object.size(qq)

# Create QQ-plot, it is the same
qqPlotFast(qq)

# Create QQ-plot with plotting parameters
qqPlotFast(qq, ylim = c(0,10), yaxmax = 9, axistep = 3, lwd = 3, cex = 1)

andreyshabalin/ramwas documentation built on Sept. 27, 2021, 7:25 p.m.