Announcement

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

  • MICE with ordinal categorical variables

    Hello,

    I'm doing multiple imputation using chained equations (MICE) on a set of ordinal variables:
    • qualification (neww2edqual): higher=1, intermediate=2 and no qual=3
    • income (nfwq5_bu_s): quintile1=1, quintile2=2,..., quintile5=5
    • smoking (bhesmk): smoker=1, non-smoker=0
    • drinking (newscako): regularly=1, occasionally=2, rarely=3
    • physical activity level (newpalevel): low=1, moderate=2, high=3
    I ran MICE on these using the following command:
    mi impute chained (ologit)neww2edqual (ologit)nfwq5_bu_s (logit)bhesmk (ologit)newscako (ologit)newpalevel, add(10)

    but got the error:
    outcome does not vary; remember:
    0 = negative outcome,
    all other nonmissing values = positive outcome
    -- above applies to specification (logit ) bhesmk

    I understood that this may be due to my coding of the above variables, and that logistic regression needs the variables to be in 0, 1, etc. form, but even when I recoded neww2edqual (as a trial to see if this works), the error message still popped up. The example on UCLA IDRE (https://stats.idre.ucla.edu/stata/se...stata_pt1_new/) seemed to be ok with categorical variable coded 1, 2, 3 though.

    Can you help me shed some light on where I've gone wrong, and what I can do to fix this problem?

    Many thanks,

    Hai

  • #2
    the error message appears to be referring to this part of your command: "(logit)bhesmk" - so does "bhesmk" have more than 2 categories? or does it have both values of "0" and values that are not "0"? maybe present a tab of the variable (within CODE delimiters - please read the FAQ)

    Comment


    • #3
      Thank you so much Rich! I totally misunderstood the error message! I thought it meant the command only worked for (logit)bhesmk, hence, been fiddling with the other variables (when they are actually ok). I knew it would be a silly mistake. Smoking (bhesmk) is a binary variable and I thought it has been coded as 0 and 1 but turned out it was 1 and 2. I've recoded this and MICE works fine now. Many thanks again.
      Hai

      Comment

      Working...
      X