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

View source: R/condMom.R

condMomR Documentation

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

Description

condMom compute moments of conditional distribution of the ith element of a multivariate normal given all others.

Usage

condMom(x, mu, sigi, i)

Arguments

x

vector of values to condition on; ith element not used

mu

mean vector with length(x) = n

sigi

inverse of covariance matrix; dimension n x n

i

conditional distribution of ith element

Details

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

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

Value

A list containing:

cmean

conditional mean

cvar

conditional variance

Warning

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

Author(s)

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

References

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

Examples

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)

bayesm documentation built on Sept. 24, 2023, 1:07 a.m.