BayesMP: MCMC for BayesMP

Description Usage Arguments Details Value Author(s) Examples

View source: R/BayesMP.r

Description

BayesMP

Usage

1
2
3
4
5
6
BayesMP(Z, gamma = NULL, updateGamma = TRUE, beta = 1/2, alpha = 1,
  mu0 = 0, sigma0 = 10, sigma = 1, trunc = 0, empMu = rep(0, ncol(Z)),
  empSD = rep(1, ncol(Z)), niter = 100, burnin = 50, silence = FALSE,
  logDotsPerLine = 50, fileName = "BayesMP_", writeY = TRUE,
  writePi = FALSE, writeDelta = FALSE, writeGamma = FALSE,
  writeHSall = TRUE)

Arguments

Z

Z statistics. Z should be a p*n matrix.

gamma

initial gamma Estimated null proportation, by default, gamma will be estimated by the emperical null method.

updateGamma

If TRUE, will update gamma by MH method. If FALSE, will keep the gamma as constant.

beta

Non-informative prior: given a gene is DE, the prior probablity this gene is up-regulated, default=1/2.

alpha

Concentration parameter for DPs, default=1.

mu0

Mean parameter for base function, default=0.

sigma0

sqrt root of variance parameter for base function, default=10.

sigma

sqrt root of variance parameter for DP mixture component, default=1.

trunc

truncation parameter for base function (For both positive component and negative component), default=0.

empMu

a vector of mean parameter for the null component, default is 0. Alternatively, this vector can by estimated by the emperical null method.

empSD

a vector of sd parameter for the null component, default is 1. Alternatively, this vector can by estimated by the emperical null method.

niter

Number of iterations. Default 100, suggest to be 10,000

burnin

Number of burnin period. Default 50, suggest to be 500

silence

If FALSE (default), will print the MCMC progress in the console.

logDotsPerLine

Number of dots printed perline in the console when silence is FALSE.

fileName

Base fileName for saving fulll mcmc results.

writeY

If TRUE, will save all (niter) posterior samples of Y from MCMC.

writePi

If TRUE, will save all (niter) posterior samples of Pi from MCMC.

writeDelta

If TRUE, will save all (niter) posterior samples of Delta from MCMC.

writeGamma

If TRUE, will save all (niter) posterior samples of Gamma from MCMC.

writeHSall

If TRUE, will save the HSall matrix (niter - burnin). Each row of HSall represent a input gene (feature). If the number in the ith column and jth row equals m, it represents there are m posterior samples of Y for feature j that are DE in at least i studies. This matrix will be the input matrix to calculate the Bayesian FDR. For example, for each column i, after normalized (divided) by total number effective samples (niter - burnin), it is the Bayesian belief that the genes are significiant in at least i studies. The Bayesian FDR can be calculated by the BayesianFDR function.

Details

implementation for BayesMP, MCMC part. This is a full Bayesian model, and the alternative distribution is modeled via dirichlet process.

Value

The MCMC object for the last iteration.

Author(s)

Zhiguang Huo <zhuo@ufl.edu>

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
set.seed(15213)
G <- 2000
K <- 10
alpha <- 200
X0 <- matrix(rnorm(G * K), G, K)
Xplus <- matrix(rnorm(G * K, 2), G, K)
Xminus <- matrix(rnorm(G * K, -2), G, K)
piall <- rbeta(G, alpha/G, 1)
delta <- rbeta(G, 1/2, 1/2)
p0 <- 1 - piall
p1 <- piall * delta
p2 <- piall * (1 - delta)
Y <- replicate(K, apply(cbind(p0, p1, p2),1,function(x) sample(c(0,1,-1),1,prob = x)))
Z <- X0 * (Y == 0) + Xplus * (Y == 1) + Xminus * (Y == -1)
system.time(BayesMP(Z,writeHSall=F))

Caleb-Huo/BayesMP documentation built on May 6, 2019, 9:27 a.m.