Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Assessing interactions after multiple imputation

    Hi,

    Could someone possibly give me some (simple!) advice on how to test for interactions between variables within a model after using multiple imputation?

    (I have found various pages related to this but I'm afraid I can't for the life of me understand them! Also apologies - can't use dataex as my code is on a secure intranet site).

    Without multiple imputed data, I have looked for whether the type of heart attack someone has (MItype) modifies the association between their degree of kidney impairment (ordinal variable ckdstage) and death within 30 days of a heart attack (death_30days), like this:

    logistic death_30days i.ckdstage MItype ethnicity i.age_grp sex.....

    estimate store A

    logistic death_30days i.ckdstage##MItype ethnicity i.age_grp sex....

    estimate store B

    lrtest A B


    However, this no longer works now that I have used multiple imputation to account for missing data in ethnicity (one of the variables in the model above). I have tried understanding something I came across about incorporating the interaction variable in the imputation model and also about using "mim" and then "milrtest" - but I've failed(!).

    Could someone possible tell me how I could do this? I'm unfortunately a terribly slow STATA learner!

    Thankyou so much

    Jemima


  • #2
    When I had a related question some time ago I wrote to tech support and here is their response:

    Code:
     There are currently two ways of performing omnibus tests for a set of categories on -mi- data.
    
    One way is manually listing the categories like the following example:  
    
    webuse mhouses1993s30
    mi estimate: regress price tax sqft age i.nfeatures
    mi test 1.nfeatures 2.nfeatures 3.nfeatures 4.nfeatures 5.nfeatures 6.nfeatures 7.nfeatures 8.nfeatures    
    
    The other way is using the -fvexpand- command (see -help fvexpand-); for example:  
    fvexpand i.nfeatures
    mi test `r(varlist)'
    You don't show your command but you should be able to translate from this

    note that -mi estimate- is not a maximum likelihood estimator and you cannot use a likelihood ratio test
    Last edited by Rich Goldstein; 14 Jun 2023, 06:46.

    Comment


    • #3
      Hi Rich,

      Thanks so much for replying.

      Sorry, yes would have been helpful for me to add my attempted command:

      mi estimate, or post: logit death_30days i.ckdstage MItype ethnicity i.age_grp sex.....

      est store A


      mi estimate, or post: logit death_30days i.ckdstage##MItype ethnicity i.age_grp sex.....

      est store B

      lrtest A B



      Thanks for your suggestions above. I wonder if that would test similarity of coefficients between the different kidney impairment (ckd) stages I have, rather than the interaction between kidney impairment and heart attack type, which is what I'm interested in? But perhaps I have the wrong end of the stick.

      Comment


      • #4
        you almost certainly need to modify what I sent for what you want; maybe (this is a guess) what you want following the second command you show is something like
        Code:
        mi test 1.ckdstage [etc. if needed] 1.MItype [again, you may need more] i.ckdstage#i.MItype
        note that I have assumed (and believe that Stata makes the same assumption) that "MItype" is categorical; you should include the "i." if so or "c." if not

        you don't say how many categories so you may need additional terms or you may not

        but maybe you only want an omnibus test on the interaction terms? if so, just drop the 1.ckdstage [etc.] and the 1.MItype [etc.]

        Comment


        • #5
          Thanks again.

          Sorry yes, I just want an omnibus test. MI type is binary. I've just tried:

          mi estimate, or post: logit death_30days i.ckdstage#MItype ethnicity i.age_grp sex.....

          Followed by:

          mi test i.ckdstage#MItype Error message: "i: operator invalid"

          mi test i.ckdstage#i.MItype Error message as above

          mi test ckdstage#MItype Error message "ckdstage#MItype not found"


          Could you possibly suggest where I'm going wrong this time?!

          Thankyou

          Comment


          • #6
            You need to include the level specification. Try

            Code:
            fvexpand i.ckdstage#i.MItype
            mi test `r(varlist)'
            Note: I am not commenting on the substantial issue of how to handle interactions in multiply imputed data in general.

            Comment


            • #7
              Hurrah it worked! Thanks SO much.

              Comment

              Working...
              X