fit.em: fit.em

Description Usage Arguments Details Value Author(s) Examples

View source: R/cFDR.R

Description

Fit a specific two Guassian mixture distribution to a set of Z values.

Usage

1
2
fit.em(Z, pi0_init = 0.9, sigma_init = 1, tol = 1e-04, verbose = TRUE,
  maxit = 10000)

Arguments

Z

numeric vector of observed data

pi0_init

initial value for pi0

sigma_init

initial value for sigma

tol

how small a change lhood prompts continued optimization

maxit

maximum number of iterations

Details

Assumes Z ~ N(0,1) with probability pi0, Z ~ N(0,1 + sigma^2) with probability 1-pi0

We define 'true' Z scores as the Z scores that would be obtained if MAF for both groups exactly matched the corresponding MAFs in the population, or equivalently the expected values of Z scores. If 'true' Z scores are distributed following a 'spike and tail' model of 0 with probability pi0 and N(0,sigma^2) with probability 1-pi0, then observed Z scores follow the above distribution.

Value

a list containing fitted pi0, fitted sigma, and a record of fitted parameters at eachs stage of the E-M algorithm.

Author(s)

Chris Wallace, James Liley

Examples

1
2
3
4
5
6
7
8
sigma <- 2
pi0 <- 0.8
n <- 10000; n0=round(pi0*n); n1=n-n0
Z <- c(rnorm(n0,0,1),rnorm(n1,0,sqrt(1+ (sigma^2))))
fit<-fit.em(Z)
fit$pi0
fit$sigma
fit$history

jamesliley/cFDR-common-controls documentation built on May 18, 2019, 11:21 a.m.