R: Estimate a threshold from Gaussian mixture distribution
twoGaussiansNull
R Documentation
Estimate a threshold from Gaussian mixture distribution
Description
Function to estimate a threshold from Gaussian mixture distribution.
The data is assumed to follow a mixture of two Gaussian
distributions. The one Gaussian with the lower mean value is assumed
to be the null distribution and probe levels are assigned p-values
based on this null distribution. The threshold is then the minimal
data value with an adjusted p-value smaller than a specified
threshold.
method for adjusting the p-values for multiple
testing; must be one of p.adjust.methods
max.adj.p
which adjusted p-value to use as upper limit for
estimating the threshold
var.equal
logical; is the variance of the two Gaussians assumed
to be equal or different
...
further arguments passed on to function Mclust
Details
This function uses the package mclust to fit a mixture of two
Gaussians to the data.
The threshold is then estimated from the fitted Gaussian with the
lower mean value.
Value
Single numeric value. The threshold that is the minimal
data value with an adjusted p-value smaller than a specified
threshold.
Note
Please note that the use of the package 'mclust' is only free for
strict academic use (see the license of 'mclust' here:
http://www.stat.washington.edu/mclust/license.txt ).
The alternative function upperBoundNull does not have
this restriction.
Thanks to Richard Bourgon for pointing out the necessity of providing
this method as an alternative way of estimating the threshold.
R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> library(Ringo)
Loading required package: Biobase
Loading required package: BiocGenerics
Loading required package: parallel
Attaching package: 'BiocGenerics'
The following objects are masked from 'package:parallel':
clusterApply, clusterApplyLB, clusterCall, clusterEvalQ,
clusterExport, clusterMap, parApply, parCapply, parLapply,
parLapplyLB, parRapply, parSapply, parSapplyLB
The following objects are masked from 'package:stats':
IQR, mad, xtabs
The following objects are masked from 'package:base':
Filter, Find, Map, Position, Reduce, anyDuplicated, append,
as.data.frame, cbind, colnames, do.call, duplicated, eval, evalq,
get, grep, grepl, intersect, is.unsorted, lapply, lengths, mapply,
match, mget, order, paste, pmax, pmax.int, pmin, pmin.int, rank,
rbind, rownames, sapply, setdiff, sort, table, tapply, union,
unique, unsplit
Welcome to Bioconductor
Vignettes contain introductory material; view with
'browseVignettes()'. To cite Bioconductor, see
'citation("Biobase")', and for packages 'citation("pkgname")'.
Loading required package: RColorBrewer
Loading required package: limma
Attaching package: 'limma'
The following object is masked from 'package:BiocGenerics':
plotMA
Loading required package: Matrix
Loading required package: grid
Loading required package: lattice
> png(filename="/home/ddbj/snapshot/RGM3/R_BC/result/Ringo/twoGaussiansNull.Rd_%03d_medium.png", width=480, height=480)
> ### Name: twoGaussiansNull
> ### Title: Estimate a threshold from Gaussian mixture distribution
> ### Aliases: twoGaussiansNull
> ### Keywords: manip
>
> ### ** Examples
>
> exDir <- system.file("exData",package="Ringo")
> load(file.path(exDir,"exampleProbeAnno.rda"))
> load(file.path(exDir,"exampleX.rda"))
> smoothX <- computeRunningMedians(exampleX, probeAnno=exProbeAnno,
+ modColumn = "Cy5", allChr = "9", winHalfSize = 400)
Chromosome 9 ...
Suz12_vs_total ...
Construction result ExpressionSet...Done.
>
> ## compare the two different ways of estimating the threshold
> y0a <- apply(exprs(smoothX), 2, upperBoundNull)
> y0b <- apply(exprs(smoothX), 2, twoGaussiansNull)
Loading required package: mclust
Package 'mclust' version 5.2
Type 'citation("mclust")' for citing this R package in publications.
>
> hist(exprs(smoothX)[,1], n=10, main=NA,
+ xlab="Smoothed expression level [log2]")
> abline(v=c(y0a, y0b), col=c("blue","orange"), lwd=2)
> legend(x="topright", col=c("blue","orange"), lwd=2,
+ legend=c(expression(paste(y[0]," Non-parametric")),
+ expression(paste(y[0]," Gaussian"))))
>
>
>
>
>
> dev.off()
null device
1
>