Announcement

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

  • Multiple imputation, mi

    Hello,

    I am trying to impute all missing values including covariates and outcomes at 3 months of follow-up and 9 months of follow-up using multiple imputation with chained equations (data were assumed to be missing at random).

    For those who had missing outcomes at both 3-month and 9-month, I'm trying to impute the outcome variables at 3 months first and use imputed data to impute the outcomes at 9 months. Can I use imputed outcome data (3months) for imputing another outcome data (9months)?

    mi set mlong
    mi register regular age sex baseline
    mi register imputed outcome_3month covariate
    mi impute chained (logit) covariate (logit) outcome_3month=age sex baline, add(20) rseed(1500) burin(20)

    How to save the imputed variables and use them to impute outcome_9month?

    Thank you so much for your help.


  • #2
    This is not the best way to do this. What you should do is impute both the 3 and 9-month outcomes at the same time. That will automatically assure that the imputed 3-month outcomes are taken into account in calculating the 9-month outcomes and vice versa. That is the correct way to do it. Do not think of a multiply imputed data set as being simulated data. It isn't, and, in fact, sometimes imputed values of variables are not even physically possible value of those variables in real life--and that is not a problem. It is also true that the 9-month imputed values have to "follow" the 3-month values. In multiple imputation, you should think of all of the variables as being "simultaneous" and all of them are used to impute all of the others.


    Code:
    miset mlong
    mi register regular age sex baseline
    mi register imputed outcome_3month outcome_9month covariate
    
    mi impute chained (logit) outcome_3month outcome_9month = age sex baseline, add(20) rseed(1500) burnin(20)
    By the way, the variable covariate should also appear on the left side of an equation in your -mi impute chained- equation.

    Comment


    • #3
      Thank you for your quick reply. This is very helpful.

      When I tried to compute both outcomes at the same time, I got this error below:

      mi impute logit: perfect predictor(s) detected
      Variables that perfectly predict an outcome were detected when logit executed on the observed data. First, specify mi impute's option noisily to identify the problem covariates. Then either remove perfect predictors from the model or specify mi impute logit's option augment to perform augmented regression; see The issue of perfect prediction during imputation of categorical data in [MI] mi impute for details. error occurred during imputation of covariate outcome_3month outcome_9month on m = 1

      How should I proceed with this?

      Thank you

      Comment


      • #4
        Do exactly what the message says. Re-run -mi impute- with the -noisily- option. You will see the logistic regression output, and that will include a message indicating that variable is a perfect predictor. Then you have a choice. If the perfect predictor is not crucial to your model, you can remove it and re-do the imputation without it. If you really need to keep that variable, then restart the multiple imputation specifying the -augment- option and the error will be dealt with by Stata for you in a different way.

        Comment

        Working...
        X