plot.DiscreteFWER {DiscreteFWER}R Documentation

Plot Method for DiscreteFWER objects

Description

Plots raw p-values of a DiscreteFWER object and highlights rejected and accepted p-values. If calculated, the critical values are plotted, too.

Usage

## S3 method for class 'DiscreteFWER'
plot(
  x,
  col = c(2, 4, 1),
  pch = c(20, 20, 17),
  lwd = rep(par()$lwd, 3),
  cex = rep(par()$cex, 3),
  type_crit = "b",
  legend = NULL,
  ...
)

Arguments

x

object of class DiscreteFWER.

col

numeric or character vector of length 3 indicating the colours of the

  1. rejected p-values

  2. accepted p-values

  3. critical values (if present).

pch

numeric or character vector of length 3 indicating the point characters of the

  1. rejected p-values

  2. accepted p-values

  3. critical values (if present and type_crit is a plot type like 'p', 'b' etc.).

lwd

numeric vector of length 3 indicating the thickness of the points and lines; defaults to current par()$lwd setting.

cex

numeric vector of length 3 indicating the size of point characters or lines of the

  1. rejected p-values

  2. accepted p-values

  3. critical values (if present).

defaults to current par()$cex setting.

type_crit

1-character string giving the type of plot desired for the critical values (e.g.: 'p', 'l' etc; see plot()).

legend

if NULL, no legend is plotted; otherwise expecting a character string like "topleft" etc. or a numeric vector of two elements indicating (x, y) coordinates.

...

further arguments to plot.default().

Value

A plot is created, but no value is returned.

Examples

X1 <- c(4, 2, 2, 14, 6, 9, 4, 0, 1)
X2 <- c(0, 0, 1, 3, 2, 1, 2, 2, 2)
N1 <- rep(148, 9)
N2 <- rep(132, 9)
Y1 <- N1 - X1
Y2 <- N2 - X2
df <- data.frame(X1, Y1, X2, Y2)
df

# Computation of p-values and their supports with Fisher's exact test
library(DiscreteTests)  # for Fisher's exact test
test_results <- fisher_test_pv(df)
raw_pvalues <- test_results$get_pvalues()
pCDFlist <- test_results$get_pvalue_supports()

DBonf_fast <- DBonferroni(raw_pvalues, pCDFlist)
DBonf_crit <- DBonferroni(test_results, critical_values = TRUE)
DHolm_fast <- DHolm(test_results)
DHolm_crit <- DHolm(raw_pvalues, pCDFlist, critical_values = TRUE)

plot(DBonf_fast)
plot(DBonf_crit, xlim = c(1, 5), ylim = c(0, 0.4))
plot(DHolm_fast, col = c(2, 4), pch = c(2, 3), lwd = c(2, 2), 
     legend = "topleft", xlim = c(1, 5), ylim = c(0, 0.4))
plot(DHolm_crit, col = c(2, 4, 1), pch = c(1, 1, 4), lwd = c(1, 1, 2), 
     type_crit = 'o', legend = c(1, 0.4), lty = 1, xlim = c(1, 5), 
     ylim = c(0, 0.4))


[Package DiscreteFWER version 1.0.0 Index]