# Default assumes a proportion of 0.01 regulated genes equally split
# between two-fold up- and down-regulated
# We select the top 1, 2, 3 percent absolute largest t-statistics
samplesize(crit=c(0.03,0.02, 0.01))
# Same model, but using a hard cutoff for the t-statistics
samplesize(crit=2:4, crit.style="cutoff")
# Paired test of the same size has slightly better FDR (as expected)
samplesize(paired=TRUE)
# Compare the effect of p0 and effect size
par(mfrow=c(2,2))
samplesize(crit=c(0.03,0.02, 0.01), p0=0.95, D=1)
samplesize(crit=c(0.03,0.02, 0.01), p0=0.99, D=1)
samplesize(crit=c(0.03,0.02, 0.01), p0=0.95, D=2)
samplesize(crit=c(0.03,0.02, 0.01), p0=0.99, D=2)
# An asymmetric alternative distribution: 20 percent of the regulated genes
# are expected to be (at least) four-fold up regulated
# NB, no graphical output
ret = samplesize(F1=list(D=c(-1,1,2), p=c(2,2,1)), p0=0.95, crit=0.05, plot=FALSE)
ret
# Look at the parameters
attr(ret, "param")
# A wide null distribution that allows to disregard genes with small effect
# Here: |log2 fold change| < 0.25, i.e. fold change of less than 19 percent
samplesize(F0=list(D=c(-0.25,0,0.25)), grid=TRUE)
# This is close to Example 3 in Jung's paper (see References):
# p0=0.99 and sensitivity=0.6, so we want a rejection rate of
# around 0.006 from the top list.
# Here we require around 40 arrays/group, compared to
# around 37 in Jung's paper, most likely because we use
# the t-distribution instead of normal. Jung's alternative
# is only one-sided, so the exact correspondence is
#
samplesize(p0=0.99,crit.style="top", crit=0.006, F1=list(D=1, p=1), grid=TRUE)
abline(h=0.01)
#The result is very close to the symmetric alternatives:
samplesize(p0=0.99,crit=0.006, D=1, grid=TRUE, ylim=c(0,0.9))
Run the code above in your browser using DataLab