em.prec {EMgaussian} | R Documentation |
EM algorithm for multivariate normal, precision matrix parameterization
Description
EM algorithm for multivariate normal, precision matrix parameterization
Usage
em.prec(
dat,
max.iter = 500,
tol = 1e-05,
start = c("diag", "pairwise", "listwise", "full"),
glassoversion = c("none", "glassoFast", "glasso", "glassonostart"),
debug = 0,
...
)
Arguments
dat |
Data frame or matrix that contains the raw data. |
max.iter |
Max number of EM cycles. |
tol |
Tolerance for change in parameter estimates across EM Cycles. If
all changes are less than |
start |
Starting value method (see details). |
glassoversion |
Character indicating whether to do regularization (lasso),
and if so, using which package. "glasso" uses the |
debug |
(Experimental) set an integer value > 1 for some information as the algorithm runs. |
... |
Arguments passed down to any of the glasso functions. |
Details
This function computes all means and the precision matrix (inverse of covariance
matrix) among a set of variables using the Expectation-Maximization (EM)
algorithm to handle missing values, and assuming multivariate normality. The
EM code was originally developed based on Stadler and Buhlmann (2012) and for
use with the graphical lasso (i.e., glasso). This version allows the possibility
of using a lasso by specifying something other than "none" for glassoversion
.
However, it can also be used without regularization to just estimate the precision matrix.
For starting values for the EM algorithm itself (not at the M-step), the
function accepts either a list that has mu
and S
slots
corresponding to the starting mean and covariance matrix. This is useful if
the user would like to use custom starting values. Otherwise, a character
corresponding to any of the options available in the startvals.cov
function will be used to take a guess at starting values.
Value
A list with the following:
p.est
: all parameter estimates as a vector (means followed by unique elements of precision matrix).mu
: estimated means.S
: estimated covariance matrix.K
: estimated precision matrix.it
: number of EM cycles completed.conv
: boolean value indicating convergence (TRUE) or not (FALSE).
References
Städler, N., & Bühlmann, P. (2012). Missing values: sparse inverse covariance estimation and an extension to sparse regression. Statistics and Computing, 22, 219–235. doi:10.1007/s11222-010-9219-7
Examples
library(psych)
data(bfi)
test <- em.prec(bfi[,1:25])