qq: Creates a Q-Q plot

View source: R/qq.R

qqR Documentation

Creates a Q-Q plot

Description

Creates a quantile-quantile plot from p-values from an association study, e.g. a genome wide association study (GWAS). We compare the data quantile with a theoretical quantile from a uniform distribution. This code is mostly adapted from the qqman package, but improved for speed. A graph with a hundred million points should only take a few seconds to generate.

Usage

qq(pvector, zero_action = NULL, ...)

Arguments

pvector

A numeric vector of p-values.

zero_action

A numeric value to substitute for p-values of exactly zero before plotting. If NULL (default), zero p-values are treated like any other invalid value and silently excluded. If a numeric value is provided (e.g. 1e-300), all zero p-values are replaced with that value and a warning is emitted stating how many were replaced.

...

Other arguments passed to plot()

Value

No return value, called for plotting side effects.

Examples

qq(stats::runif(1e6))

# Handle p-values of zero by substituting a small finite value
pvec <- c(stats::runif(1e4), 0, 0)
qq(pvec, zero_action = 1e-300)

fastqq documentation built on March 13, 2026, 9:08 a.m.