This is an internal (non-exported) function. This help page provides additional documentation mainly intended for developers and expert users.

compute_posterior_matrices_common_cov_R(
  data,
  A,
  Ulist,
  posterior_weights,
  output_posterior_cov = FALSE,
  posterior_samples = 0,
  seed = 123
)

Arguments

data

a mash data object, eg as created by mash_set_data or mash_set_data_contrast

A

the linear transformation matrix, Q x R matrix. This is used to compute the posterior for Ab.

Ulist

a list of P covariance matrices for each mixture component

posterior_weights

the JxP posterior probabilities of each mixture component in Ulist for the data

output_posterior_cov

whether or not to output posterior covariance matrices for all effects

posterior_samples

the number of samples to be drawn from the posterior distribution of each effect.

seed

a random number seed to use when sampling from the posteriors. It is used when posterior_samples > 0.

Value

PosteriorMean JxQ matrix of posterior means

PosteriorSD JxQ matrix of posterior (marginal) standard deviations

NegativeProb JxQ matrix of posterior (marginal) probability of being negative

ZeroProb JxQ matrix of posterior (marginal) probability of being zero

lfsr JxQ matrix of local false sign rates

PosteriorCov QxQxJ array of posterior covariance matrices, if the output_posterior_cov = TRUE

PosteriorSamples JxQxM array of samples, if the

posterior_samples = M > 0

Details

The computations are performed without allocating an excessive amount of memory.