data(zmat)
# The z-scores are binned and priors are given to each hypothesis state:
input3 <- ztobins(zmat, 3, plot = TRUE)
pbz <- input3$pdf.binned.z
bz <- input3$binned.z.mat
# Fdr calculation:
output3 <- repfdr(pbz, bz, "replication") # converge after 209 iterations.
BayesFdr <- output3$mat[,"Fdr"]
sum(BayesFdr <= 0.05) # 119
Pi <- output3$Pi
# The posterior probabilities for the features with Bayes FDR at most 0.05:
post <- ldr(pbz,bz[which(BayesFdr <= 0.05)[1:5],],Pi)
round(post,4)
# posteriors for a subset of the association status vectors can also be reported:
post <- ldr(pbz,bz[which(BayesFdr <= 0.05)[1:5],],Pi,h.vecs= 1:5)
round(post,4)
Run the code above in your browser using DataLab