qvalue_tidiers: Tidying methods for a qvalue object

Description Usage Arguments Value Examples

Description

These are methods for turning a qvalue object, from the qvalue package for false discovery rate control, into a tidy data frame. augment returns a data.frame of the original p-values combined with the computed q-values and local false discovery rates, tidy constructs a table showing how the estimate of pi0 (the proportion of true nulls) depends on the choice of the tuning parameter lambda, and glance returns a data.frame with only the chosen pi0 value.

Usage

1
2
3
4
5
6
7
8
## S3 method for class 'qvalue'
tidy(x, ...)

## S3 method for class 'qvalue'
augment(x, data, ...)

## S3 method for class 'qvalue'
glance(x, ...)

Arguments

x

qvalue object

...

extra arguments (not used)

data

Original data

Value

All tidying methods return a data.frame without rownames. The structure depends on the method chosen.

tidy returns one row for each choice of the tuning parameter lambda that was considered (argument lambda to qvalue), containing

lambda

the tuning parameter

pi0

corresponding estimate of pi0

smoothed

whether the estimate has been spline-smoothed)

If pi0.method="smooth", the pi0 estimates and smoothed values both appear in the table. If pi0.method="bootstrap", smoothed is FALSE for all entries.

augment returns a data.frame with

p.value

the original p-values given to qvalue

q.value

the computed q-values

lfdr

the local false discovery rate

glance returns a one-row data.frame containing

pi0

the estimated pi0 (proportion of nulls)

lambda

lambda used to compute pi0. Note that if pi0 is 1, this may be NA since it can be ambiguous which lambda was used

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
library(ggplot2)
if (require("qvalue")) {
set.seed(2014)

# generate p-values from many one sample t-tests: half of them null
oracle <- rep(c(0, .5), each=1000)
pvals <- sapply(oracle, function(mu) t.test(rnorm(15, mu))$p.value)
qplot(pvals)

q <- qvalue(pvals)

tidy(q)
head(augment(q))
glance(q)

# use augmented data to compare p-values to q-values
ggplot(augment(q), aes(p.value, q.value)) + geom_point()

# use tidy see how pi0 estimate changes with lambda, comparing
# to smoothed version
g <- ggplot(tidy(q), aes(lambda, pi0, color=smoothed)) + geom_line()
g

# show the chosen value
g + geom_hline(yintercept=q$pi0, lty=2)
}

biobroom documentation built on Nov. 8, 2020, 5:20 p.m.