5
$\begingroup$

I have data from two separate cohorts. If not imputed, I would just rbind() the two datasets and analyse. But due to non-random missing values, imputation was needed for both cohorts separately. So now I have data from two cohorts which are imputed 5 times each. Resulting in 5 imputed datasets for both cohorts (10 datasets).

How would you analyse or combine these data? I think rbind.mids() can be used to combine two sets of imputed data.

If I do that, will results from such a combined dataset still make sense? For example, can pool() still be used?

$\endgroup$

2 Answers 2

2
$\begingroup$

I suggest to combine the data of the 2 cohorts in the forefront and impute afterwards. To include the information about the 2 different cohorts into your imputation, you could add a cohort variable.

Here is an example in R:

# Example data
N <- 1000
x1 <- rnorm(N)
x2 <- x1 + rnorm(N)
x3 <- x2 + rnorm(N)
x1[rbinom(N, 1, 0.1) == 1] <- NA
x2[rbinom(N, 1, 0.1) == 1] <- NA
x3[rbinom(N, 1, 0.1) == 1] <- NA
data_c1 <- data.frame(x1 = x1[1:(N / 2)],
                  x2 = x2[1:(N / 2)],
                  x3 = x3[1:(N / 2)])
data_c2 <- data.frame(x1 = x1[501:N],
                  x2 = x2[501:N],
                  x3 = x3[501:N])

# Combine data sets
data <- rbind(data_c1, data_c2)

# Add cohort vector
data$cohort <- as.factor(c(rep(1, N / 2), rep(2, N / 2)))

# Impute; cohort vector is used as auxiliary variable
library("mice")
imp <- mice(data)
data_imp <- complete(imp, "broad")

At this point, you could apply further analysis steps, like pool() for example.

$\endgroup$
1
$\begingroup$

For many models it will make sense to combine the two cohorts together before imputation and use mice on the combined data to impute them simultaneously. However, there could be times when you would want to specify different imputation methods or use different variables for imputation in different cohorts. For example, if some variables are only measured in certain cohorts then imputation in those cohorts may be specified to take advantage of the extra information. It is possible to impute them separately and combine the imputations using mice::rbind. In the below R code I impute one set of data using predictive mean matching and the other using Bayesian linear regression, then combine the two sets of imputations and fit a glm to the combined imputations.

library(mice)
set.seed(123)
N = 100

x1 <- rnorm(n = N)
y1 <- x1 + rnorm(n = N)
y1[which(rbinom(n = N, size = 1, prob = 0.3) == 1)] <- NA #Make some missing
data1 <- data.frame(x = x1,y = y1)

x2 <- rnorm(n = N)
y2 <- x2 + rnorm(n = N)
y2[which(rbinom(n = N, size = 1, prob = 0.3) ==1)] <- NA
data2 <- data.frame(x = x2,y = y2)

impute_1 <- mice(data = data1,
                 method = "pmm")
impute_2 <-mice(data = data2,
                method = "norm")
imputes_full <- rbind(impute_1,impute_2)

models <- with(data = imputes_full,
               expr = {glm(y~x)})
summary(pool(models))
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.