Learn R Programming

ALDEx3 (version 1.0.2)

coefficient.sm: Coefficient-based scale model with user-specified prior on fixed effects

Description

Draws Monte Carlo samples of the log2 scale by sampling fixed-effect coefficients from a multivariate normal distribution and mapping them through the design matrix X. This scale model is useful when you want to encode prior information about how covariates (e.g., treatment, batch, time) affect scale, rather than specifying scale moments directly per sample.

Usage

coefficient.sm(X, logComp, c.mu = NULL, c.cor = NULL)

Value

A numeric matrix of dimension N x nsample giving Monte Carlo draws of the log2 scale for each sample (rows) across nsample draws (columns).

Arguments

X

A numeric design matrix passed internally by aldex() to the scale model. Rows correspond to fixed-effect coefficients/covariates (P = nrow(X)) and columns correspond to samples (N = ncol(X)). (Automatically supplied by aldex().)

logComp

A numeric array of Monte Carlo log-compositions with dimensions features x samples x nsample. This scale model uses nsample (the number of Monte Carlo draws) but does not otherwise use logComp. (Automatically supplied by aldex().)

c.mu

Numeric vector of length P giving the mean of the fixed effect coefficients in log2-scale space. Must not be NULL.

c.cor

Numeric P x P covariance matrix for the fixed effect coefficients in log2-scale space. Must not be NULL.

Author

Kyle McGovern

Details

Specifically, for each Monte Carlo draw \(b^{(m)} \sim N(c.mu, c.cor)\), the per-sample log2 scale is computed as \(b^{(m)T} X\), producing an N x nsample matrix of log2-scale draws.

For example, with an intercept and a treatment indicator where treatment is expected to increase log2 scale by ~1 on average, one might use c.mu = c(0, 1) and c.cor = diag(c(0.25, 0.25)) (i.e., SD 0.5 for each coefficient, independent).