| affine_transform | R Documentation |
Computes the distribution of AX + b where X \sim MVN(\mu, \Sigma).
The result is MVN(A\mu + b, A \Sigma A^T).
affine_transform(x, A, b = NULL)
x |
A |
A |
A numeric matrix (or scalar for univariate). |
b |
An optional numeric vector (or scalar) for the offset. Default is a zero vector. |
For a univariate normal, scalars A and b are promoted
to 1x1 matrices and scalar internally. Returns a normal if the
result is 1-dimensional.
A normal or mvn distribution.
X <- mvn(c(0, 0), diag(2))
# Project to first component via 1x2 matrix
Y <- affine_transform(X, A = matrix(c(1, 0), 1, 2), b = 5)
mean(Y)
# Scale a univariate normal
Z <- affine_transform(normal(0, 1), A = 3, b = 2)
mean(Z)
vcov(Z)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.