Description Usage Arguments Details Value Note Author(s) References See Also Examples
Compute and plot power, reqired sample-size, or detectible effect size for gene expression experiment
1 2 3 4 5 6 7 8 9 10 11 12 13 | pow(sd, n, delta, sig.level, alpha.correct = "Bonferonni")
power.plot(x, xlab = "Power", ylab = "Proportion of Genes with Power >= x",
marks = c(0.7, 0.8, 0.9), ...)
ssize(sd, delta, sig.level, power, alpha.correct = "Bonferonni")
ssize.plot(x, xlab = "Sample Size (per group)",
ylab = "Proportion of Genes Needing Sample Size <= n",
marks = c(2, 3, 4, 5, 6, 8, 10, 20), ...)
delta(sd, n, power, sig.level, alpha.correct = "Bonferonni")
delta.plot (x, xlab = "Fold Change",
ylab = "Proportion of Genes with Power >= 80% at Fold Change=delta",
marks = c(1.5, 2, 2.5, 3, 4, 6, 10), ...)
|
sd |
Vector of standard deviations for control samples, *on the log2 scale* |
n |
Number of observations (per group) |
delta |
Hypothetical True difference in expression, on the log2 scale. |
sig.level |
Significance level (Type I error probability) |
power |
Power |
alpha.correct |
Type of correction for multiple comparison. One of "Bonferonni" or "None". |
x |
Vector of powers generated by |
xlab, ylab |
x and y axis labels |
marks |
Powers at which percent of genes achieving the specified cutoff is annotated on the plot. |
... |
Additional graphical parameters |
The pow
function computes power for each element of a gene
expression experiment using an vector of estimated standard
deviations. The power is computed separately for each gene, with an
optional correction to the significance level for multiple
comparison. The power.plot
function generates a cumulative
power plot illustrating the fraction and number of genes achieve a
given power for the specified sample size, significance level, and
delta.
Periods are printed for every 10 calculations so that the user can see that the computation is proceeding.
pow
returns a vector containing the power for each standard deviation.
This code was intended to be used with data are on the log2 scale, in which case the delta can be set to becomes log2(fold-change).
Gregory R. Warnes greg@warnes.net
Warnes GR and Fasheng Li Warnes GR and Liu P, “Sample Size Selection for Microarray Experiments” submitted to Biometrics.
Warnes GR and Fasheng Li, “Sample Size Selection for Microarray based Gene Expression Studies,” Talk, "2003 FDA/Industry Statistics Workshop: From Theory to Regulatory Acceptance", American Statistical Association, Bethesda, MD, Sept 18-19, 2003. http://www.warnes.net/Research/PresentationFolder/SampleSize.pdf
ssize
,
ssize.plot
,
delta
,
delta.plot
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 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 | library(gdata) # for nobs()
data(exp.sd)
# Histogram of the standard deviations
hist(exp.sd,n=20, col="cyan", border="blue", main="",
xlab="Standard Deviation (for data on the log scale)")
dens <- density(exp.sd)
lines(dens$x, dens$y*par("usr")[4]/max(dens$y),col="red",lwd=2)
title("Histogram of Standard Deviations")
# 1) What is the power if using 6 patients 3 measurements assuming
# Delta=1.0, Alpha=0.05 and Observed SDs?
#
n=6; fold.change=2.0; power=0.8; sig.level=0.05;
#
all.power <- pow(sd=exp.sd, n=n, delta=log2(fold.change),
sig.level=sig.level)
power.plot(all.power, lwd=2, col="blue")
xmax <- par("usr")[2]-0.05; ymax <- par("usr")[4]-0.05
legend(x=xmax, y=ymax,
legend= strsplit( paste("n=",n,",",
"fold change=",fold.change,",",
"alpha=", sig.level, ",",
"# genes=", nobs(exp.sd), sep=''), "," )[[1]],
xjust=1, yjust=1, cex=1.0)
title("Power to Detect 2-Fold Change")
# 2) What is necessary sample size for 80% power using 3 measurements/patient
# assuming Delta=1.0, Alpha=0.05 and Observed SDs?
#
all.size <- ssize(sd=exp.sd, delta=log2(fold.change),
sig.level=sig.level, power=power)
ssize.plot(all.size, lwd=2, col="magenta", xlim=c(1,20))
xmax <- par("usr")[2]-1; ymin <- par("usr")[3] + 0.05
legend(x=xmax, y=ymin,
legend= strsplit( paste("fold change=",fold.change,",",
"alpha=", sig.level, ",",
"power=",power,",",
"# genes=", nobs(exp.sd), sep=''), "," )[[1]],
xjust=1, yjust=0, cex=1.0)
title("Sample Size to Detect 2-Fold Change")
# 3) What is necessary fold change to achieve 80% power using 3
# measurements/patient assuming n=6, Delta=1.0, Alpha=0.05 and Observed
# SDs?
#
all.delta <- delta(sd=exp.sd, power=power, n=n,
sig.level=sig.level)
delta.plot(all.delta, lwd=2, col="magenta", xlim=c(1,10))
xmax <- par("usr")[2]-1; ymin <- par("usr")[3] + 0.05
legend(x=xmax, y=ymin,
legend= strsplit( paste("n=",n,",",
"alpha=", sig.level, ",",
"power=",power,",",
"# genes=", nobs(exp.sd), sep=''), "," )[[1]],
xjust=1, yjust=0, cex=1.0)
title("Fold Change to Achieve 80% Power")
|
Loading required package: gdata
sh: 1: cannot create /dev/null: Permission denied
gdata: Unable to locate valid perl interpreter
gdata:
gdata: read.xls() will be unable to read Excel XLS and XLSX files
gdata: unless the 'perl=' argument is used to specify the location of a
gdata: valid perl intrpreter.
gdata:
gdata: (To avoid display of this message in the future, please ensure
gdata: perl is installed and available on the executable search path.)
sh: 1: cannot create /dev/null: Permission denied
gdata: Unable to load perl libaries needed by read.xls()
gdata: to support 'XLX' (Excel 97-2004) files.
gdata: Unable to load perl libaries needed by read.xls()
gdata: to support 'XLSX' (Excel 2007+) files.
gdata: Run the function 'installXLSXsupport()'
gdata: to automatically download and install the perl
gdata: libaries needed to support Excel XLS and XLSX formats.
Attaching package: 'gdata'
The following object is masked from 'package:stats':
nobs
The following object is masked from 'package:utils':
object.size
The following object is masked from 'package:base':
startsWith
Loading required package: xtable
..........................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.