powered by
condMom compute moments of conditional distribution of the \(i\)th element of a multivariate normal given all others.
condMom
condMom(x, mu, sigi, i)
A list containing:
conditional mean
conditional variance
vector of values to condition on; \(i\)th element not used
mean vector with length(x) = \(n\)
length(x)
inverse of covariance matrix; dimension \(n x n\)
conditional distribution of \(i\)th element
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.
\(x\) \(\sim\) \(MVN(mu, sigi^{-1})\).
condMom computes moments of \(x_i\) given \(x_{-i}\).
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)
Run the code above in your browser using DataLab