My code stopped working after updating the mice (Multiple Equations by Chained Equations) package to version >3. I wish to retrieve the estimated variance-covariance matrix from linear regressions on multiply imputed datasets. This quantity (which mice calls t) could be easily accessed in version 2.46.0 using the pool function. In version >3.0 of mice, the pool function does not return the full variance-covariance matrix anymore, it only returns the diagonal elements of the variance-covariance matrix.
Here is a working example:
First create some dataset with missing values:
set.seed(243)
iris$Sepal.Length[sample(length(iris$Sepal.Length), size = 5)] <- NA
iris$Sepal.Width[sample(length(iris$Sepal.Width), size = 5)] <- NA
iris$Petal.Length[sample(length(iris$Petal.Length), size = 5)] <- NA
iris$Species[sample(length(iris$Species), size = 5)] <- NA
Second multiply impute the missing data
iris.mi <- mice(iris, 5)
Third perform linear regression on each of the multiply imputed dataset, storing results in a mira object
mira.out <- with(iris.mi, lm(Sepal.Width ~ Sepal.Length + Petal.Length + Petal.Width + Species))
Fourth, pool results from these analyses using Rubin's rules. This is implemented by the pool function in mice.
pool.out <- pool(analyses)
In version 2.46.0 of the mice package, one could retrieve the full variance covariance matrix t by typing
pool.out$t
In newer versions (>3.0) of the mice package, the pool.out$t object does not exist. All one can do, is retrieve the variances by typing
pool.out$pooled
and selecting the column labeled t. There seems to be no way of accessing the full variance-covariance matrix. All one has access to are the diagonal elements of the matrix, which are stored in the t column of the pool.out$pooled data.frame.
I want to access the full variance covariance matrix because I need to calculate marginal effects and confidence intervals for interacted terms in a linear regression with multiply imputed data. These confidence intervals can be approximated by using only the diagonal elements of the variance-covariance matrix, but it would make much better sense to use the full variance-covariance matrix.
I wonder why this change was implemented in the mice package, and how I might be able to access the variance-covariance matrix in the newer versions.
Thank you for your help.