R/rmvnormpost.R

Defines functions rmvnormpost

rmvnormpost <-
function (n, prior.mean, prior.precision, sample.mean, sample.precision, RNORM.METHOD)
{
	post.cov = solve (as.matrix(prior.precision + n*sample.precision))
	post.mean = as.vector (post.cov %*% (prior.precision %*% prior.mean + n*sample.precision %*% sample.mean))
	
	result = rMVNorm (1, mean=post.mean, sigma=post.cov, method=RNORM.METHOD)
#	result = rmvnorm (1, mean=post.mean, sigma=post.cov, method=RNORM.METHOD)
	
	return (result)
}

Try the DIRECT package in your browser

Any scripts or data that you put into this service are public.

DIRECT documentation built on May 29, 2017, 10:59 a.m.