mids object in matchMulti package

Hi everyone,

I'm currently working on a script in which I investigate an school intervention effect on health outcomes.
Since i'm taking into account clustering at the school level i'm using the matchMulti package to match on schools & students.

However, before I got to that point I used the mice package for multiple imputation (m=5) of the missing covariate data. However, I ended up with a large mids-object.
However, this mids-object cannot be inserted as the dataset input in matchMulti. At least I don't know how.

What I've tried is making a long format of the mids-object, and inserting that long format of the multiple imputated data into matchMulti. However, that results in a dataframe 6 times the ammount of rows in comparison with the original one. 6 rows of data for each participant in my study (5 times imputation & the 1 original).
The problem is that matchMulti than sees these as seperate subjects, therefore i'm ending up with 6000 matched students in the output, whereas there were only 3200 unique subjects in my study.

Does anyone have a suggestion or solution to my problem?

Thanks in advance!! :slight_smile:

genr_dataset_zWRpeak_imp <- mice(genr_dataset_zWRpeak, predictorMatrix = predictorMatrix, m=5, maxit = 50, method = 'pmm', seed = 500)

long_genr_dataset_zWRpeak_imp <- complete(genr_dataset_zWRpeak_imp, action = 'long', include = TRUE)


match.out <-
matchMulti(long_genr_dataset_zWRpeak_imp, treatment = 'intervention_group',
school.id = 'SCHOOL_BRIN', match.students = TRUE,
student.vars = student.vars, verbose = TRUE, tol= .01)

My suggestion is to first apply matchMulti to the data without imputation to see what's possible without mice. If you've tried that, or if the results are troublesome, please provide a reprex. See the FAQ using data(catholic_schools), creating some missing data comparable to yours and show the resulting mids object.

Thank you, I will try your suggestion!