plotly_FDR: Plot False Discovery Rate (FDR) estimates from output by...

View source: R/plotly_FDR.R

plotly_FDRR Documentation

Plot False Discovery Rate (FDR) estimates from output by EM-like strategies using plotly

Description

This is an updated version of plotFDR. For more technical details, please refer to plotFDR.

Usage

plotly_FDR(post1, post2=NULL, lg1="FDR 1", lg2=NULL, 
          compH0=1, alpha=0.1, complete.data =NULL, pctfdr=0.3,
          col = NULL, width = 3 ,
          title = NULL , title.size = 15 , title.x = 0.5 , title.y = 0.95,
          xlab = "Index" , xlab.size = 15 , xtick.size = 15,
          ylab = "Probability" , ylab.size = 15 , ytick.size = 15,
          legend.text = "" , legend.text.size = 15 , legend.size = 15)

Arguments

post1

The matrix of posterior probabilities from objects such as the output from spEMsymlocN01. The rows need to be sorted by increasing pvalues.

post2

A second object like post1 if comparison is desired, also sorted by increasing pvalues.

lg1

Text describing the FDR estimate in post1.

lg2

Text describing the FDR estimate in post2 if provided.

compH0

The component indicator associated to the null hypothesis H0, normally 1 since it is defined in this way in spEMsymlocN01, but in case of label switching in other algorithms it can be set to 2.

alpha

The target FDR level; the index at which the FDR estimate crosses the horizontal line for level alpha gives the maximum number of cases to reject.

complete.data

An array with n lines and 2 columns, with the component indicator in column 1 and the p-values in column 2, sorted by p-values.

pctfdr

The level up to which the FDR is plotted, i.e. the scale of the vertical axis.

col

Color of traces.

width

Width of traces.

title

Text of the main title.

title.size

Size of the main title.

title.x

Horsizontal position of the main title.

title.y

Vertical posotion of the main title.

xlab

Label of X-axis.

xlab.size

Size of the lable of X-axis.

xtick.size

Size of tick lables of X-axis.

ylab

Label of Y-axis.

ylab.size

Size of the lable of Y-axis.

ytick.size

Size of tick lables of Y-axis.

legend.text

Title of legend.

legend.text.size

Size of the legend title.

legend.size

Size of legend.

Value

A plot of one or two FDR estimates, with the true FDR if available

Author(s)

Didier Chauveau

References

  • Chauveau, D., Saby, N., Orton, T. G., Lemercier B., Walter, C. and Arrouys, D. Large-scale simultaneous hypothesis testing in monitoring carbon content from French soil database – A semi-parametric mixture approach, Geoderma 219-220 (2014), 117-124.

See Also

spEMsymlocN01, plotFDR

Examples

## Probit transform of p-values
## from a Beta-Uniform mixture model
## comparion of parametric and semiparametric EM fit
## Note: in actual situations n=thousands
set.seed(50)
n=300 # nb of multiple tests
m=2 # 2 mixture components
a=c(1,0.1); b=c(1,1); lambda=c(0.6,0.4) # parameters
z=sample(1:m, n, rep=TRUE, prob = lambda)
p <- rbeta(n, shape1 = a[z], shape2 = b[z]) # p-values
o <- order(p)
cpd <- cbind(z,p)[o,] # sorted complete data, z=1 if H0, 2 if H1
p <- cpd[,2] # sorted p-values
y <- qnorm(p) # probit transform of the pvalues
# gaussian EM fit with component 1 constrained to N(0,1)
s1 <- normalmixEM(y, mu=c(0,-4),
                  mean.constr = c(0,NA), sd.constr = c(1,NA))
s2 <- spEMsymlocN01(y, mu0 = c(0,-3)) # spEM with N(0,1) fit
plotly_FDR(s1$post, s2$post, lg1 = "normalmixEM", lg2 = "spEMsymlocN01",
           complete.data = cpd) # with true FDR computed from z

mixtools documentation built on Dec. 5, 2022, 5:23 p.m.