Provide condition-wise summary based on posterior distributions for each effect.

get_posterior_condition_wise_summary(mash_data, m, contrast_mat)

Arguments

mash_data

A mash data object, e.g. as created by mash_set_data

m

A mash fit, typically an output from mash.

contrast_mat

A matrix applied to mashr fitting result, enabling comparisons for different conditions based on posteior distributions.

Examples


# The following example performs pairwise comparisons in a data set
# with 5 conditions: that is, it compares conditions (column) 1 and
# 2, 1 and 3, 1 and 4, 1 and 5, 2 and 3, etc.
library(Matrix)
set.seed(1)
simdata <- simple_sims(100,5,1)
dat <- mash_set_data(simdata$Bhat,simdata$Shat)
U <- cov_canonical(dat)
m <- mash(dat,U)
#>  - Computing 400 x 151 likelihood matrix.
#>  - Likelihood calculations took 0.03 seconds.
#>  - Fitting model with 151 mixture components.
#>  - Model fitting took 0.26 seconds.
#>  - Computing posterior matrices.
#>  - Computation allocated took 0.00 seconds.
x <- combn(5,2)
n <- ncol(x)
contrast_mat <- as.matrix(sparseMatrix(i = rep(1:n,each = 2),
                                       j = as.vector(x),
                                       x = 1,dims = c(n,5)))
res <- get_posterior_condition_wise_summary(dat,m,contrast_mat)