| coefficient.sm | R Documentation |
Use this model when prior information describes a treatment, group, time, or other model coefficient rather than an individual sample. Samples with the same covariate values share the same scale shift in each Monte Carlo draw.
coefficient.sm(
X,
logComp,
c.mu = NULL,
c.cor = NULL,
c.sd = NULL,
c.cov = NULL
)
X |
Model matrix passed automatically by |
logComp |
Monte Carlo log-compositions passed automatically by
|
c.mu |
Expected log2 scale change for each model coefficient, in the
same order as the rows of |
c.cor |
Deprecated |
c.sd |
SD of the log2 scale change for each model coefficient. Must
have length |
c.cov |
A |
Suppose an effect plot from a control-versus-treatment experiment is
centered near -8, even though prior knowledge suggests that most features
should not change. One way to represent that knowledge is to shift the
treatment samples upward by 8 log2 units relative to the controls. With
control as the reference level, use c.mu = c(0, 8): the first value
leaves the common intercept unchanged, and the second adds 8 to treatment.
Setting c.sd = c(0, 0.5) expresses an SD of 0.5 around that treatment
shift. If the plot were centered near +8, use -8 instead. Adding 8 to both
groups would not recenter the plot because it would leave their difference
unchanged.
More generally, c.mu gives the expected log2 scale change for each
model coefficient and c.sd gives its SD. Use c.cov when the
coefficient uncertainties are correlated. For each Monte Carlo draw,
ALDEx3 samples a coefficient vector and applies it to the model matrix
X; mathematically, b^{(m)} \sim N(c.mu, Sigma) and the sample
scales are b^{(m)T} X.
Exactly one of c.sd or c.cov must be provided. The deprecated
c.cor argument may be used in place of c.cov during the
compatibility period.
A numeric matrix of dimension N x nsample giving Monte Carlo
draws of the log2 scale for each sample (rows) across nsample draws
(columns).
Kyle McGovern
# Three control samples followed by three treatment samples.
condition <- factor(
c("control", "control", "control", "treatment", "treatment", "treatment"),
levels = c("control", "treatment")
)
X <- t(model.matrix(~ condition))
logComp <- array(0, c(2, 6, 10))
logScale <- coefficient.sm(
# Shift treatment upward by 8, with SD 0.5 around that shift.
X, logComp, c.mu = c(0, 8), c.sd = c(0, 0.5)
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.