Fit poisson mash to data

pois_mash(
  data,
  Ulist,
  ulist,
  ulist.epsilon2 = rep(1e-08, length(ulist)),
  normalizeU = TRUE,
  gridmult = 2,
  wlist,
  ruv = FALSE,
  Fuv,
  rho,
  update.rho = TRUE,
  update.mu = TRUE,
  verbose = FALSE,
  C = diag(ncol(data$X)) - 1/ncol(data$X),
  res.colnames = paste0(colnames(data$X), "-mean"),
  posterior_samples = 0,
  median_deviations = FALSE,
  seed = 1,
  init = list(),
  control = list()
)

pois_mash_control_default()

Arguments

data

“pois.mash” data object, typically created by calling pois_mash_set_data.

Ulist

List of H full-rank covariance matrices, such as the list of covariance matrices Ulist returned by pois_cov_ed).

ulist

List of G numeric vectors each of which forms a rank-1 covariance matrix, such as the list of vectors ulist returned by pois_cov_ed.

ulist.epsilon2

Numeric vector of length G used to add a small positive value to the diagonals of each rank-1 prior covariance matrix to avoid tight error bars.

normalizeU

Logical scalar indicating whether to normalize the prior covariances to have a maximum of 1 on diagonal.

gridmult

Numeric scalar indicating factor by which adjacent grid values should differ; use a number close to 1 for fine grid.

wlist

Numeric vector of length L giving the scaling factors for the prior covariance matrices

ruv

Logical scalar indicating whether to account for unwanted variation. When ruv = TRUE, Fuv must be provided.

Fuv

J x D matrix of latent factors causing unwanted variation, with features as rows and latent factors as columns.

rho

D x R matrix of effects corresponding to unwanted variation, such that bias = Fuv %*% rho.

update.rho

A logical scalar indicating whether to update effects corresponding to unwanted variation. Ignored if ruv = FALSE.

update.mu

A logical scalar indicating whether to update gene-specific means mu. If update.mu = FALSE, initial mu must be provided in init.

verbose

A logical scalar indicating whether to print ELBO at each iteration.

C

Q x R matrix of contrasts for effects. The default contrasts matrix is an matrix of condition-wise differences relative to the mean across all conditions.

res.colnames

Character vector of length Q giving the names of the contrasts.

posterior_samples

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

median_deviations

Logical scalar indicating whether to calculate posterior summary of deviation of condition-specific effects relative to the median over all conditions.

seed

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

init

List of initial values for model parameters, such as an output from pois_mash_ruv_prefit).

control

List of control parameters with the following elements: “maxiter”, maximum number of outer loop iterations; “maxiter.q”, maximum number of inner loop iterations for updating the variational parameters at each outer loop iteration; “maxpsi2”, maximum value for the gene-specific dispersion parameter psi2.; “maxbias”, maximum value for the gene-specific range of bias caused by unwanted variation; “tol.mu”, threshold for mu (gene-specific, subgroup-specific means on the log scale) to skip update; “tol.psi2”, relative threshold for psi2 (gene-specific dispersion parameter) to skip update; “tol.bias”, threshold for bias caused by unwanted variation to skip update; “tol.q”, relative tolerance for assessing convergence of variational parameters at each iteration; “tol.rho”, tolerance for assessing convergence of effects corresponding to unwanted variation; nc, the maximum number of threads used in the multithreaded updates. Any named components will override the default optimization algorithm settings (as they are defined by pois_mash_control_default).

Value

List with the following elements:

result

List containing the posterior summaries of the J x Q matrix of effects.

pois.mash.fit

List containing the parameter estimates of the poisson mash model.