Learn R Programming

bayesm (version 3.1-6)

condMom: Computes Conditional Mean/Var of One Element of MVN given All Others

Description

condMom compute moments of conditional distribution of the \(i\)th element of a multivariate normal given all others.

Usage

condMom(x, mu, sigi, i)

Value

A list containing:

cmean

conditional mean

cvar

conditional variance

Arguments

x

vector of values to condition on; \(i\)th element not used

mu

mean vector with length(x) = \(n\)

sigi

inverse of covariance matrix; dimension \(n x n\)

i

conditional distribution of \(i\)th element

Warning

This routine is a utility routine that does not check the input arguments for proper dimensions and type.

Author

Peter Rossi, Anderson School, UCLA, perossichi@gmail.com.

Details

\(x\) \(\sim\) \(MVN(mu, sigi^{-1})\).

condMom computes moments of \(x_i\) given \(x_{-i}\).

References

For further discussion, see Bayesian Statistics and Marketing by Rossi, Allenby, and McCulloch.

Examples

Run this code
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