covEM | R Documentation |

This function computes a covariance matrix from data with some values missing at random. The code was written by Eric from StackExchange. https://stats.stackexchange.com/questions/182718/ml-covariance-estimation-from-expectation-maximization-with-missing-data

covEM(dat_missing, iters = 1000)

`dat_missing` |
a matrix with missing values |

`iters` |
the number of iterations to perform to estimate missing values |

Beale, E. M. L., & Little, R. J. A.. (1975). Missing Values in Multivariate Analysis. Journal of the Royal Statistical Society. Series B (methodological), 37(1), 129–145.

# make data with missing values missing_mtcars <- mtcars for(i in 1:20){ missing_mtcars[sample(1:nrow(mtcars),1),sample(1:ncol(mtcars),1)]<-NA } covmat<-covEM(as.matrix(missing_mtcars))$sigma calpha(covmat)

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.