twoGaussiansNull: Estimate a threshold from Gaussian mixture distribution

Description Usage Arguments Details Value Note Author(s) See Also Examples

View source: R/twoGaussianNull.R

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.

Usage

1
twoGaussiansNull(x, p.adj.method = "BY", max.adj.p = 0.1, var.equal = FALSE, ...)

Arguments

x

numeric vector of data values

p.adj.method

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.

Author(s)

Joern Toedling, Aleksandra Pekowska

See Also

mclust, p.adjust, upperBoundNull

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
  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)

  ## compare the two different ways of estimating the threshold
  y0a <- apply(exprs(smoothX), 2, upperBoundNull)
  y0b <- apply(exprs(smoothX), 2, twoGaussiansNull)

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

Example output

Loading required package: Biobase
Loading required package: BiocGenerics
Loading required package: parallel

Attaching package:BiocGenericsThe following objects are masked frompackage:parallel:

    clusterApply, clusterApplyLB, clusterCall, clusterEvalQ,
    clusterExport, clusterMap, parApply, parCapply, parLapply,
    parLapplyLB, parRapply, parSapply, parSapplyLB

The following objects are masked frompackage:stats:

    IQR, mad, sd, var, xtabs

The following objects are masked frompackage:base:

    anyDuplicated, append, as.data.frame, basename, cbind, colnames,
    dirname, do.call, duplicated, eval, evalq, Filter, Find, get, grep,
    grepl, intersect, is.unsorted, lapply, Map, mapply, match, mget,
    order, paste, pmax, pmax.int, pmin, pmin.int, Position, rank,
    rbind, Reduce, rownames, sapply, setdiff, sort, table, tapply,
    union, unique, unsplit, which.max, which.min

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:limmaThe following object is masked frompackage:BiocGenerics:

    plotMA

Loading required package: Matrix
Loading required package: grid
Loading required package: lattice

Chromosome 9 ...
Suz12_vs_total ... 
Construction result ExpressionSet...Done.
Loading required package: mclust
Package 'mclust' version 5.4.7
Type 'citation("mclust")' for citing this R package in publications.

Ringo documentation built on Nov. 8, 2020, 5:34 p.m.