Compute weights with mr.mash using a precomputed prior grid and mixture prior.
Usage
mrmashWrapper(
X,
Y,
V = NULL,
sumstats = NULL,
dataDrivenPriorMatrices = NULL,
priorGrid = NULL,
nthreads = 1,
canonicalPriorMatrices = FALSE,
standardize = FALSE,
updateW0 = TRUE,
w0Threshold = 1e-08,
updateV = TRUE,
updateVMethod = "full",
bInitMethod = "enet",
maxIter = 5000,
tol = 0.01,
verbose = FALSE,
...
)Arguments
- X
An n x p matrix of genotype data, where n is the total number of individuals and p is the number of SNPs.
- Y
An n x r matrix of residual expression data, where n is the total number of individuals and r is the total number of conditions (tissue/cell-types).
- V
Optional residual covariance matrix (conditions x conditions), or
NULLto estimate it.- sumstats
Optional list of summary statistics for the RSS variant of mr.mash, or
NULLfor the individual-data variant.- dataDrivenPriorMatrices
A list of data-driven covariance matrices. Default is NULL.
- priorGrid
A vector of scaling factors to be used in fitting the mr.mash model. Default is NULL.
- nthreads
The number of threads to use for parallel computation. Default is 2.
- canonicalPriorMatrices
A logical indicating whether to use canonical matrices as priors. Default is FALSE.
- standardize
A logical indicating whether to standardize the input data. Default is FALSE.
- updateW0
A logical indicating whether to update the prior mixture weights. Default is TRUE.
- w0Threshold
The threshold for updating prior mixture weights. Default is 1e-8.
- updateV
A logical indicating whether to update the residual covariance matrix. Default is TRUE.
- updateVMethod
The method for updating the residual covariance matrix. Default is "full".
- bInitMethod
The method for initializing the coefficient matrix. Default is "enet".
- maxIter
The maximum number of iterations. Default is 5000.
- tol
The tolerance for convergence. Default is 0.01.
- verbose
A logical indicating whether to print verbose output. Default is FALSE.
- ...
Additional arguments to be passed to mr.mash.
Value
A mr.mash fit, stored as a list with some or all of the following elements:
- mu1
A p x r matrix of posterior means for the regression coefficients.
- S1
An r x r x p array of posterior covariances for the regression coefficients.
- w1
A p x K matrix of posterior assignment probabilities to the mixture components.
- V
An r x r residual covariance matrix.
- w0
A K-vector with (updated, if
update_w0=TRUE) prior mixture weights, each associated with the respective covariance matrix inS0.- S0
An r x r x K array of prior covariance matrices on the regression coefficients.
- intercept
An r-vector containing the posterior mean estimate of the intercept.
- fitted
An n x r matrix of fitted values.
- G
An r x r covariance matrix of fitted values.
- pve
An r-vector of proportion of variance explained by the covariates.
- ELBO
The Evidence Lower Bound (ELBO) at the last iteration.
- progress
A data frame including information regarding convergence criteria at each iteration.
- converged
A logical indicating whether the optimization algorithm converged to a solution within the chosen tolerance level.
- elapsed_time
The computation runtime for fitting mr.mash.
- Y
An n x r matrix of responses at the last iteration (only relevant when missing values are present in the input Y).
Examples
data(multiTraitData)
res <- mrmashWrapper(
X = multiTraitData$X[, 1:60], Y = multiTraitData$Y,
dataDrivenPriorMatrices = multiTraitData$priorMatrices,
canonicalPriorMatrices = TRUE
)