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

logpost.norm

Observed-data log-posterior for normal data


Description

Evaluates the log of the observed-data posterior density at a user-supplied value of the parameter. Assumes a normal-inverted Wishart prior. This function is useful for monitoring the progress of EM and data augmentation.

Usage

logpost.norm(s, theta, prior)

Arguments

s

summary list of an incomplete normal data matrix created by the function prelim.norm.

theta

vector of normal parameters expressed on transformed scale in packed storage, such as one produced by the function em.norm.

prior

optional prior distribution. This is a list containing the hyperparameters of a normal-inverted Wishart distribution. In order, the elements of the list are: tau (a scalar), m (a scalar), mu0 (a vector of length ncol(x), where x is the original matrix of incomplete data), and lambdainv (a matrix of dimension c(ncol(x),ncol(x))). The elements of mu0 and lambdainv apply to the data after transformation, i.e. after the columns have been centered and scaled to have mean zero and variance one. If no prior is supplied, the default is the usual noninformative prior for a multivariate normal model: tau=0, m=-1, mu0=arbitrary, and lambdainv = matrix of zeros.

Value

value of the observed-data log-posterior density

References

See Section 5.3.5 of Schafer (1996)

See Also

Examples

data(mdata)
s <- prelim.norm(mdata)   #do preliminary manipulations
prior <- list(0,.5,rep(0,ncol(mdata)),
   .5*diag(rep(1,ncol(mdata)))) #ridge prior with .5 df
thetahat <- em.norm(s,prior=prior)   #compute posterior mode
logpost.norm(s,thetahat,prior)  #log-posterior at mode

norm

Analysis of Multivariate Normal Datasets with Missing Values

v1.0-10.0
GPL (>= 2)
Authors
Ported to R by Alvaro A. Novo <alvaro@novo-online.net>. Original by Joseph L. Schafer <jls@stat.psu.edu>.
Initial release
2022-04-02

We don't support your browser anymore

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