I am looking to do a canonical correlations analysis (CCA) in R, using the CCA
package, on a multiply imputed dataset (obtained from the mice package).
I know that the mice
package allows you to pool the complete data sets and do linear models and general linear models using formulas, e.g.:
mice.data <- mice(data, m = 5)
mice.lm <- with(data = mice.data, exp = lm(y ~ x + ...))
pooled.mice.lm <- pool(mice.lm)
but I don't think it has the ability to do that for CCA. The reason is that the pool
function requires a variance-covariance matrix, which CCA does not compute.
Question:
- What is the best way to pool my data sets/results? Is it valid to do a CCA on each complete data set separately, then average the canonical variables for each imputation to obtain a final set of canonical variables?
- Or is there some way to do this all at once with a long-format
complete()
dataset that contains separate .id and .imp variables?
E.g. for Question 1:
Vars 2-5 are the predictor set, and vars 6-15 are the criterion set; the merged data that includes both are imputed together to produce mice.data.
mice.data <- mice(data, m = 5)
mice.data.list <- vector("list", 5)
for (i in 1:5) {
m.data <- complete(mice.data, i)
predictors <- m.data[, 2:5]
criterions <- m.data[, 6:15]
mice.data.list[[i]] <- cc(predictors, criterions)
}
So I end up with a list of canonical correlations on each complete imputed dataset, which I then have to figure out how to average/pool together.
Alternatively, for Question 2, I'd have a single data frame with a separate .imp variable specifying the number of imputation for that dataset, but I'd still have to figure out how to pool those results together, potentially with a clever aggregation? Perhaps this isn't possible, actually.