condMom {bayesm} | R Documentation |
condMom
compute moments of conditional distribution of the ith element of a multivariate normal given all others.
condMom(x, mu, sigi, i)
x |
vector of values to condition on; ith element not used |
mu |
mean vector with |
sigi |
inverse of covariance matrix; dimension n x n |
i |
conditional distribution of ith element |
x ~ 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.
http://www.perossi.org/home/bsm-1
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)