symm_fit_ind_EM {csmGmm}R Documentation

symm_fit_ind.R

Description

Fit the conditionally symmetric multidimensional Gaussian mixture model for sets of independent elements

Usage

symm_fit_ind_EM(
  testStats,
  initMuList,
  initPiList,
  sameDirAlt = FALSE,
  eps = 10^(-5),
  checkpoint = TRUE
)

Arguments

testStats

J*K matrix of test statistics where J is the number of sets and K is number of elements in each set.

initMuList

List of 2^K elements where each element is a matrix with K rows and number of columns equal to the number of possible mean vectors for that binary representation.

initPiList

List of 2^K elements where each element is a vector with number of elements equal to the number of possible mean vectors for that binary representation.

sameDirAlt

Boolean, set to TRUE for replication testing, which uses a smaller alternative space.

eps

Scalar, stop the EM algorithm when L2 norm of difference in parameters is less than this value.

checkpoint

Boolean, set to TRUE to print iterations of EM

Value

A list with the elements:

muInfo

List with same dimensions as initMuList, holds the final mean parameters.

piInfo

List with same dimensions as initPiList, holds the final mixture proportions

iter

Number of iterations run in EM algorithm.

lfdrResults

J*1 vector of all lfdr statistics.

Examples

set.seed(0)
testStats <- cbind(rnorm(10^4), rnorm(10^4))
testStats[1:200, 1] <- rnorm(100, mean=3)
testStats[201:400, 1] <- rnorm(100, mean=5)
testStats[401:600, 2] <- rnorm(100, mean=3)
testStats[601:800, 2] <- rnorm(100, mean=5)
testStats[801:1000, 1:2] <- rnorm(200, mean=7)
initMuList <- list(matrix(data=0, nrow=2, ncol=1), matrix(data=c(0, 3, 0, 5), nrow=2, ncol=2),
matrix(data=c(3, 0, 5, 0), nrow=2, ncol=2), matrix(data=c(7, 7), nrow=2, ncol=1))
initPiList <- list(c(0.9), c(0.02, 0.02),c(0.02, 0.02), c(0.02))
results <- symm_fit_ind_EM(testStats = testStats, initMuList = initMuList, initPiList = initPiList)


[Package csmGmm version 0.3.0 Index]