condMom | R Documentation |
condMom
compute moments of conditional distribution of the i
th element of a multivariate normal given all others.
condMom(x, mu, sigi, i)
x |
vector of values to condition on; |
mu |
mean vector with |
sigi |
inverse of covariance matrix; dimension |
i |
conditional distribution of |
x
\sim
MVN(mu, sigi^{-1})
.
condMom
computes moments of x_i
given x_{-i}
.
A list containing:
cmean |
conditional mean |
cvar |
conditional variance |
This routine is a utility routine that does not check the input arguments for proper dimensions and type.
Peter Rossi, Anderson School, UCLA, perossichi@gmail.com.
For further discussion, see Bayesian Statistics and Marketing by Rossi, Allenby, and McCulloch.
sig = matrix(c(1, 0.5, 0.5, 0.5, 1, 0.5, 0.5, 0.5, 1), ncol=3)
sigi = chol2inv(chol(sig))
mu = c(1,2,3)
x = c(1,1,1)
condMom(x, mu, sigi, 2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.