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

ninvwish

Random normal-inverted Wishart variate


Description

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.

Usage

ninvwish(s, params)

Arguments

s

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

params

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.

Value

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.

WARNING

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

References

See Section 5.4.2 of Schafer (1996).

See Also

Examples

data(mdata)
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
rngseed(1234567)
start <- ninvwish(s,params)  # draw a variate
thetahat <- em.norm(s,start=start) # run EM from this starting value

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.