ninvwish: Random normal-inverted Wishart variate

View source: R/norm.R

ninvwishR Documentation

Random normal-inverted Wishart variate


Simulates a value from a normal-inverted Wishart distribution. This function may be useful for obtaining starting values of the parameters of a multivariate normal distribution for multiple chains of data augmentation.


ninvwish(s, params)



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


list of parameters 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)), and lambdainv (a matrix of dimension c(ncol(x),ncol(x))). When using this function to create starting values for data augmentation, mu0 and lambdainv should be chosen in relation to the data matrix after the columns have been centered and scaled to have mean zero and variance one.


a vector in packed storage representing the simulated normal-inverted Wishart variate. This vector has the same form as parameter vectors produced by functions such as em.norm and da.norm, and may be used directly as a starting value for these functions. This vector can also be put into a more understandable format by getparam.norm.


Before this function may be used, the random number generator seed must be initialized with rngseed at least once in the current S session.


See Section 5.4.2 of Schafer (1996).

See Also

rngseed, getparam.norm, em.norm and da.norm.


s <- prelim.norm(mdata)   #do preliminary manipulations
params <- list(1,.5,rep(0,ncol(mdata)), .5*diag(rep(1,ncol(mdata)))) # gives widely dispersed values
start <- ninvwish(s,params)  # draw a variate
thetahat <- em.norm(s,start=start) # run EM from this starting value

norm documentation built on April 4, 2022, 1:06 a.m.

Related to ninvwish in norm...