Learn R Programming

ALDEx3 (version 1.0.2)

sample.sm: Sample-specific scale model with user-specified mean and variance/covariance

Description

Draws Monte Carlo samples of the log2 scale for each sample using user-supplied moments. This scale model is useful when external measurements (e.g., qPCR, flow cytometry, spike-ins) provide information about absolute scale, or when you want to encode prior information about scale on a per-sample basis.

Usage

sample.sm(X, logComp, s.mu = NULL, s.var = NULL, s.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. Columns correspond to samples (N = ncol(X)). This scale model does not use X directly, but N is inferred from it. (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 to determine the number of Monte Carlo draws, but does not otherwise use logComp. (Automatically supplied by aldex().)

s.mu

Numeric vector of length N giving the mean of the log2 scale for each sample. Must not be NULL.

s.var

Numeric vector of length N giving the marginal variance of the log2 scale for each sample. Use this when assuming samples' log2 scales are independent. Must be NULL if s.cor is provided.

s.cor

Numeric N x N covariance matrix for the log2 scale across samples. Use this when encoding correlations between samples' log2 scales. Must be NULL if s.var is provided.

Author

Kyle McGovern

Details

Exactly one of s.var or s.cor must be provided:

  • s.var: independent per-sample log2-scale variance (diagonal covariance)

  • s.cor: full N x N log2-scale covariance matrix

The returned matrix has N rows (samples) and nsample columns (Monte Carlo draws), consistent with the ALDEx3 scale-model interface.