Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

condMom

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 ~ 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.
http://www.perossi.org/home/bsm-1

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

Bayesian Inference for Marketing/Micro-Econometrics

v3.1-4
GPL (>= 2)
Authors
Peter Rossi <perossichi@gmail.com>
Initial release
2019-10-14

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.