Learn R Programming

bayesm (version 2.0-9)

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

Description

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

Usage

condMom(x, mu, sigi, i)

Arguments

x
vector of values to condition on - ith element not used
mu
length(x) mean vector
sigi
length(x)-dim covariance matrix
i
conditional distribution of ith element

Value

  • a list containing:
  • cmeancond mean
  • cvarcond variance

concept

  • normal distribution
  • conditional distribution

Warning

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

Details

$x$ $\sim$ $MVN(mu,Sigma)$. condMom computes moments of $x_i$ given $x_{-i}$.

References

For further discussion, see Bayesian Statistics and Marketing by Rossi, Allenby and McCulloch. http://faculty.chicagogsb.edu/peter.rossi/research/bsm.html

Examples

Run this code
##
sig=matrix(c(1,.5,.5,.5,1,.5,.5,.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