I am trying to run an analysis using a dataset imputed through the mice package. However, when using the with() function to run a linear regression on the imputed data, I get an error stating that the variables I am trying to analyze do not exit. Here is an example:
imputed_dataset <- mice(original_data, formulas = list_of_formulas, m = 5, maxit = 10)
model <- with(imputed_dataset, lm(my_outcome ~ some_imputed_predictor + other_predictor_that_was_not_imputed))
I can get the with() function to return a model if I only include predictors that have been imputed by Mice. I am not able to get the function to work if a variable that was not imputed is included in the formula. What should I do to be able to run my regression model, with some imputed predictors and some non-imputed predictors?