#simulate a partially observed dataset from multivariate normal distribution
set.seed(1234)
n <- 100
temp <- MASS::mvrnorm(n=n,mu=rep(0,4),Sigma=diag(4))
#make some values missing
for (i in 1:4) {
temp[(runif(n)<0.25),i] <- NA
}
#impute using normImp
imps <- normImp(data.frame(temp), M=10, pd=FALSE, rseed=4423)
Run the code above in your browser using DataLab