9I have a dataset (500 rows) with missing values in different variables for a propensity score analysis. First I created the propensity score matching by omitting the rows with missing values (about 100 rows) in the variables I used for propensity score calculation, but now I would like to try to impute the missing values with the mice package.
In a first step I imputed the data like this:
impute <- mice(mydata, method = methods, predictorMatrix = predictormatrix, m = 5, maxit = 3) mydata <- complete(impute)
So - as far as I understand - "mydata" now is a new data frame with the imputed values, but it is the first out of 5 different attempts of imputation (because the first attempt is used by default).
Now, as "mydata" is a data frame, I have my "full" data available and can continue with my propensity score matching code:
# matching match <- matchit(treatment ~ independent1 + independet2 + independent3, data = mydata, method = "nearest") matched_data <- match.data(match) # model for outcome by treatment model <- glm(outcome ~ treatment, data = matched_data, family = binomial(link = "logit")) publish(model)
So this obviously works if I'm fine with using only the first out of 5 possible imputed datasets (as far as I now "complete" uses the first dataset by default).
Now my question is: I read about the "pool" function, but it seems that in the end I need a regression formula (like seen here https://rdrr.io/cran/mice/man/pool.html at the end of the page > "Example"). My favorite result of the imputed data would be a completed dataset with the same number of rows as before the imputation process (5oo rows) but with imputed values (by all 5 datasets) instead of NAs.
final_imputed_data <- complete(impute) # don't use the first imputed dataset (out of 5) but all 5
Or do I misunderstand the sense of multiple imputation?