Learn R Programming

dlsem (version 1.0)

EM.imputation: Imputation of missing values using Expectation-Maximization

Description

Missing values of numerical variables are replaced by their expected value computed using the Expectation-Maximization (EM) algorithm. A Multivariate Gaussian distribution is assumed.

Usage

EM.imputation(x = NULL, group = NULL, data, plotDir = NULL, tol = 0.0001, maxit = 500)

Arguments

x
A vector containing the name of the numerical variables to be imputed. If NULL, all numerical variables will be imputed.
group
The name of a group factor (optional). If NULL, no groups are considered.
data
An object of class data.frame containing the variables to be imputed and, if group is not NULL, the group factor.
plotDir
A directory where to save the plots after imputation (optional). If NULL, no plots will be produced.
tol
The tolerance threshold of the EM algorithm. Default is 0.0001.
maxit
The maximum number of iterations for the EM algorithm. Default is 500.

Value

  • The object of class data.frame provided to argument data, where the requested variables have been imputed.

References

A. P. Dempster, N. M. Laird, D. B. Rubin (1977). Maximum Likelihood from Incomplete Data via the EM Algorithm. Jornal of the Royal Statustical Society, Series B, 39(1), 1-38.

See Also

unirootTest, applyDiff

Examples

Run this code
data(agres)
EM.imputation(c("PPI","ENTR_INCOME"),group="COUNTRY",data=agres)

Run the code above in your browser using DataLab