Hello. I am trying to do multiple imputation to compare its regression output to listwise deletion.
I was chiefly concerned with the p_educ variable because, as you can see from my data below, it has by far the most missings.
So I started with that variable, and this code seemed to work well:
But, as you can also see, my other variables have a handful of missings as well. Is it possible for me to do multiple imputation for all of those other variables? (except for convinced_level, which is my primary predictor variable and, for a number of reasons, shouldn't be imputed)
Is it as simple as just repeating the "mi impute regress var1 var2 etc." line over and over for each variable that I want to impute, before doing "mi estimate: regress"? Or is there a more efficient way to impute multiple variables all in one go?
Here is some toy data that resembles the structure of my actual data (which is identifiable and unable to be shared publicly). Thank you much!!
I was chiefly concerned with the p_educ variable because, as you can see from my data below, it has by far the most missings.
So I started with that variable, and this code seemed to work well:
Code:
mi set mlong mi register imputed health p_educ p_income gender race age mi impute regress p_educ health p_income gender race age, add(20) rseed (1234) force mi estimate: regress health p_educ p_income gender race age convinced_level
Is it as simple as just repeating the "mi impute regress var1 var2 etc." line over and over for each variable that I want to impute, before doing "mi estimate: regress"? Or is there a more efficient way to impute multiple variables all in one go?
Here is some toy data that resembles the structure of my actual data (which is identifiable and unable to be shared publicly). Thank you much!!
Code:
* Example generated by -dataex-. For more info, type help dataex clear input byte(health p_educ) int p_income byte(gender race age) long convinced_level 3 3 23 1 . 13 2 4 . . 2 2 14 1 2 5 45 1 3 15 . 3 . 65 2 4 14 2 4 . 23 1 1 14 1 5 3 45 1 3 12 3 3 4 88 . 2 12 1 2 . 132 1 3 12 3 3 5 34 2 2 14 2 4 3 54 1 1 14 1 3 2 23 2 3 18 3 2 . 52 1 2 18 2 2 4 47 1 2 18 1 3 3 . 2 2 15 3 4 2 78 . 1 15 2 2 2 43 2 4 . 1 3 3 23 1 1 14 3 4 4 65 . 4 17 . 5 . 143 2 1 17 3 3 3 5 1 . 17 2 2 4 . 2 1 19 1 3 . 23 1 1 . 2 4 3 34 1 1 18 1 3 4 45 2 2 15 3 2 3 76 1 3 15 2 2 2 6 2 2 15 1 3 . 33 2 2 15 3 4 3 . 1 1 12 1 2 4 23 2 1 12 3 3 2 52 1 1 12 2 2 . 47 1 2 14 1 2 . 84 2 2 14 2 3 . 78 1 . 18 1 4 . 43 2 3 18 3 2 2 23 2 4 18 2 3 4 34 . 1 15 1 4 5 45 2 1 15 3 5 3 76 1 1 14 1 3 4 61 1 2 14 3 2 3 90 2 1 14 2 3 2 27 1 4 18 1 4 . 63 2 1 18 3 3 2 34 2 4 18 2 3 3 63 1 1 15 1 3 2 52 2 2 13 3 3 4 15 1 2 14 2 2 1 62 . 1 15 2 2 1 73 2 1 14 2 end label values convinced_level label label def label 1 "no", modify label def label 2 "yes", modify label def label 3 "maybe", modify
Comment