qqplot_pvals: QQ-plot a vector of p-values.

Description Usage Arguments Value Examples

View source: R/qqplot.R

Description

QQ-plot a vector of p-values.

Usage

1
2
3
4
5
6
7
8
qqplot_pvals(
  x,
  labels = NULL,
  controls = NULL,
  cases = NULL,
  lambda_correct = FALSE,
  aes_opts = list(null_alpha = 1, fit_alpha = 1)
)

Arguments

x

A numeric vector with elements in (0, 1).

labels

A character vector of length at most length(x). Labels for the smallest p-values.

controls

Number of controls in the tests.

cases

Number of cases in the tests.

lambda_correct

A flag. Apply a correction to make the slope of the fitted line equal to 1.

aes_opts

A list. Aesthetic options for the plot. The list has two named elements.

  • null_alpha: Transparency of the x = y line.

  • fit_alpha: Transparency of the fit line.

Value

A ggplot2::ggplot().

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
set.seed(1)
pvals <- runif(999) ^ (4 / 3)
qqplot_pvals(pvals,
  controls = 500, cases = 499,
  aes_opts = list(null_alpha = 0.5, fit_alpha = 0.5)
)
qqplot_pvals(pvals,
  labels = c("a", "b", "c"),
  controls = 500, cases = 499,
  lambda_correct = TRUE
)

mirvie/mirmodels documentation built on Jan. 14, 2022, 11:12 a.m.