Closed ekstroem closed 9 years ago
Thanks Claus. For this situation it is sufficient (and indeed simpler) to not generate the interaction variable in the data frame, but simply to use the code as in your second block:
imps <- smcfcs(minidata, smtype="lm",
smformula="y ~ x + g + x*g",
method=c("", "", "mlogit"))
If you were however, to go down the dummy variable approach, this should work. g would be imputed using mlogit, the dummies would be imputed passively based on g, and the interactions would similarly be imputed passively (by specifying the appropriate expressions in the method argument).
I will modify the interaction example in the package to show the simpler approach.
Thanks!
I was wondering about the best way to specify interactions with multiple levels.
I have the following situation:
I want to fit a model with an interaction between
x
andg
.Now what is the proper way to specify the interaction? In the example with
ex_lininter
the following code is used, wherex1x2
is already defined in the data frame as the product ofx1
andx2
.I can manually code dummy variables to things up and running like the example above but then I seem to miss the 3 levels of my factor when I impute the missing values in the
g
variable. Running the following code works, but here the "artificial" construction of the interaction in the data frame is skipped and the improvement gained by including the interaction in the imputation is lost.