plot_qq: QQ Plot

View source: R/plot_qq.R

plot_qqR Documentation

QQ Plot

Description

This function plots expected vs. observed p-values following -log10 transform.

Usage

plot_qq(dat, lambda = FALSE, title = "QQ Plot", hover = FALSE)

Arguments

dat

Either a vector of p-values, optionally named, or any object with a column for p-values coercable to a data frame. Missing values are silently removed.

lambda

Calculate genomic inflation factor? See Details.

title

Optional plot title.

hover

Show probe name by hovering mouse over data point? If TRUE, the plot is rendered in HTML and will either open in your browser's graphic display or appear in the RStudio viewer. Probe names are extracted from dat.

Details

QQ plots are a common way to visually assess the applicability of a statistical test to a given data set. If the black points deviate too sharply from the red line, especially at low expected values of -log10(p), then it suggests a violation of the assumptions upon which the test was based.

In addition, plot_qq optionally calculates the genomic inflation factor lambda, defined as the ratio of the median of the observed distribution of the test statistic to the expected median. Inflated lambda-values (i.e., lambda > 1) are indicative of a high false positive rate, possibly due to some systematic and unaccounted for bias in the data.

Examples

df <- data.frame(p.value = runif(1e4))
plot_qq(df, lambda = TRUE)

library(DESeq2)
dds <- makeExampleDESeqDataSet()
dds <- DESeq(dds)
res <- results(dds)
plot_qq(res)


dswatson/bioplotr documentation built on March 3, 2023, 9:43 p.m.