plot.FDX: Plot Method for 'FDX' objects

View source: R/plot_funs.R

plot.FDXR Documentation

Plot Method for FDX objects

Description

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

Usage

## S3 method for class 'FDX'
plot(
  x,
  col = c(2, 4, 1),
  pch = c(1, 1, 1),
  lwd = c(1, 1, 1),
  type.crit = "b",
  legend = NULL,
  ...
)

Arguments

x

an object of class "FDX".

col

a numeric or character vector of length 3 indicating the colors of the

  1. rejected p-values

  2. accepted p-values

  3. critical values (if present).

pch

a 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

a numeric vector of length 3 indicating the thickness of the points and lines.

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.

Details

If x contains results of a weighted approach, the Y-axis of the plot is derived from the weighted p-values. Otherwise, it is constituted by the raw ones.

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

# Construction of the p-values and their supports (fisher.pvalues.support
# is from 'DiscreteFDR' package!)
df.formatted <- fisher.pvalues.support(counts = df, input = "noassoc")
raw.pvalues <- df.formatted$raw
pCDFlist <- df.formatted$support

DLR.sd.fast <- DLR(raw.pvalues, pCDFlist)
DLR.sd.crit <- DLR(raw.pvalues, pCDFlist, critical.values = TRUE)
DLR.su.fast <- DLR(raw.pvalues, pCDFlist, direction = "su")
DLR.su.crit <- DLR(raw.pvalues, pCDFlist, direction = "su", critical.values = TRUE)

plot(DLR.su.fast)
plot(DLR.su.crit, xlim = c(1, 5), ylim = c(0, 0.4))
plot(DLR.sd.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(DLR.sd.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))


FDX documentation built on Oct. 18, 2022, 9:09 a.m.