symm_fit_cor_EM_noAssumption {csmGmm} | R Documentation |
symm_fit_cor_noAssumption.R
Description
Fit the correlated csmGmm for sets of correlated elements, but we don't assume that the means in the composite alternative are greater in magnitude than those in the composite null.
Usage
symm_fit_cor_EM_noAssumption(
testStats,
corMat,
initMuList,
initPiList,
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. |
corMat |
K*K matrix that describes the correlation structure of 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 group. |
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 group. |
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 probability parameters. |
iter |
Number of iterations run in EM algorithm. |
lfdrResults |
J*1 vector of all lfdr statistics. |
Examples
set.seed(0)
corMat <- matrix(data=c(1, 0.3, 0.3, 1), nrow=2)
testStats <- rbind(mvtnorm::rmvnorm(n=200, mean=c(3, 0), sigma=corMat),
mvtnorm::rmvnorm(n=200, mean=c(0, 4), sigma=corMat),
mvtnorm::rmvnorm(n=100, mean=c(7, 7), sigma=corMat),
mvtnorm::rmvnorm(n=10^4 - 500, mean=c(0, 0), sigma=corMat))
initMuList <- list(matrix(data=0, nrow=2, ncol=1), matrix(data=c(0, 3), nrow=2),
matrix(data=c(4, 0), nrow=2), matrix(data=c(5, 5), nrow=2))
initPiList <- list(c(0.9), c(0.04), c(0.04), c(0.02))
results <- symm_fit_cor_EM_noAssumption(testStats = testStats,
corMat = cor(testStats), initMuList = initMuList, initPiList = initPiList)