Performs maximumlikelihood estimation on the matrix of incomplete data using the EM algorithm. Can also be used to find a posterior mode under a normalinverted Wishart prior supplied by the user.
1 
s 
summary list of an incomplete normal data matrix produced by the
function 
start 
optional starting value of the parameter. This is a parameter vector
in packed storage, such as one created by the function

showits 
if 
maxits 
maximum number of iterations performed. The algorithm will stop if the parameter still has not converged after this many iterations. 
criterion 
convergence criterion. The algorithm stops when the maximum relative difference in all of the estimated means, variances, or covariances from one iteration to the next is less than or equal to this value. 
prior 
optional prior distribution. This is a list containing the hyperparameters of a normalinverted 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))). The elements of mu0 ans 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 a uniform prior, which results in maximumlikelihood estimation. 
The default starting value takes all means on the transformed scale to be equal to zero, and covariance matrix on the transformed scale equal to the identity. All important computations are carried out in double precision, using the sweep operator.
a vector representing the maximumlikelihood estimates of the normal
parameters. This vector contains means, variances, and covariances on
the transformed scale in packed storage. The parameter can be
transformed back to the original scale and put into a more
understandable format by the function getparam.norm
.
See Section 5.3 of Schafer (1994).
prelim.norm
, getparam.norm
, and makeparam.norm
.
1 2 3 4  data(mdata)
s < prelim.norm(mdata) #do preliminary manipulations
thetahat < em.norm(s) #compute mle
getparam.norm(s,thetahat,corr=TRUE)$r #look at estimated correlations

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.
Please suggest features or report bugs with the GitHub issue tracker.
All documentation is copyright its authors; we didn't write any of that.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.