calibrateP {mixfdr}R Documentation

Internal Utility Functions

Description

These functions are used by mixfdr to calculate various things. calibrateP is used to calibrate the penalization, and getStartsNew gets a reasonable starting point for the fitting. matDens computes a density matrix. mixModelFitter is the workhorse model fitter, and mixModelManyStarts is used to try various starting points.

Usage

calibrateP(m, B = 25)
getStartsNew(x, J, noiseSD = 1)
matDens(x, mu, sig)
mixModelFitter(x, J, N, starts, maxiter, tol, p, muInt, sigInt)
mixModelManyStarts(x, J, N, starts = NA, maxiter = 1000, tol = 0.001, p = NA, muInt = NA, sigInt = 1, theonull = FALSE)

Arguments

m A mixture model, that is, a list with pi, mu and sigma vectors of the same length, and a data vector
B Number of bootstrap datasets to generate for each candidate penalization
x Data to fit on. For matDens, any vector of points to calculate the densities on
mu A vector of means
sig A vector of standard deviations. Should be the same length as mu
J Number of mixture components
noiseSD The sampling standard deviation
N Somewhat confusingly, the penalization parameter. Called P by functions intended for user use
starts A matrix of starts. The matrix should be J x 3, with column 1 for pi, 2 for mu, and 3 for sigma. For mixModelManyStarts, this should be an array, with dimension (num starts, J, 3).
maxiter Max number of iterations
tol Convergence tolerance
p Penalization vector. Must be of length J. Nearly always (1,0,...,0)
muInt mu constraints, a J x 2 matrix. mu[j] will be forced to lie in [mu[j,1],mu[j,2].Inf and -Inf allowed. If missing, each row will be [-Inf,Inf]
sigInt sigma constraints, similar to muInt. First column should be positive. For mixModelManyStarts, if a constant s, each row will be [s,Inf]
theonull Use the theoretical null? If true, sets muInt[1,] = 0 and sigInt[1,] = 1

Details

These functions are not intended for user use, with the possible exception of calibrateP. Most people will want to use mixFdr and/or one of the utilities like effectSize.

calibrateP perturbs the null standard deviation of the supplied model and fits many models with many penalizations to try and see which penalization is best when the true model is "close" to the supplied model. It can be quite slow.

getStartsNew finds a decent starting point by dividing up the data into J quantile groups, with the middle group larger than the others. It then calculates the within group mean and sd to use as mu and sigma starting points.

matDens is a faster way to compute dnorm(x[i],mu[j],sig[j]) for all i and j

mixModelFitter fits the mixture model with the EM algorithm. It is fairly quick.

mixModelManyStarts fits many mixture models (with different starting points) and chooses the one with the highest penalized likelihood.

Value

calibrateP returns a penalization. getStartsNew returns a start matrix. matDens returns a matrix M with M[i,j] = dnorm(x[i],mu[j],sig[j]). mixModelFitter and mixModelManyStarts return mixture models - lists with pi, mu, sigma, and data elements.

Author(s)

Omkar Muralidharan

References

See papers at the author's website http://stat.stanford.edu/~omkar

See Also

mixfdr, effectSize


[Package mixfdr version 1.0 Index]