biobroom (version 1.4.2)

qvalue_tidiers: Tidying methods for a qvalue object

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

"tidy"(x, ...)
"augment"(x, data, ...)
"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

Run this code

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)
}

Run the code above in your browser using DataCamp Workspace