Learn R Programming

Ringo (version 1.36.0)

twoGaussiansNull: 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.

Usage

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

Value

Single numeric value. The threshold that is the minimal data value with an adjusted p-value smaller than a specified threshold.

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.

See Also

mclust, p.adjust, upperBoundNull

Examples

Run this code
  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"))))

Run the code above in your browser using DataLab