Question: Unfortunately, all variables in my model of interest (MOI), from both levels of analysis, include missing cases. Furthermore, I wish to examine interaction terms of some of these variables, where one of these is a interaction of two level 1 categorical variables, another is an interaction of a level 1 continues variable with a categorical one, and yet another is a cross level interaction of a continues level 1 variable with a continues level 2 variable. I'm trying to use the just another variable (JAV) approach to impute the missing cases in all these variables. Essentially, the model is:
realcomImpute X1 m.X2 o.X3 X1*X2 X2*X3 W1*X1 W1 W2 X4 W5 using MIInput.dat, replace numresponses(8) level2id(school) cons(cons)
My problem is quite technical – how do I define the interaction terms as responses when using the realcomImpute command. Obviously, the '*' symbol is wrong. I tried using '#' but it doesn’t work. Is it right to create new variables, multiplying all relevant variables and creating the dummies (in the case of the categorical interaction) although they are response variables here? Will Realcom know to handle this case properly (It will have the same missing cases in all the dummies)? If not, what is the correct syntax?
Answer: Leaving aside for a moment whether JAV with multi-level data is a reasonable approach, you need to manually define the new variables in Stata for each of the interaction terms which you wish to impute, and then pass these as additional response variables to the realcomImpute command.