Announcement

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

  • -mimrgns- and Predicted Probabilities with Multilevel Data

    Dear all,

    I am trying to estimate marginal effects and predicted probabilities for a multilevel (logistic) analysis, treated with multiple imputation procedures. I have been able to get the linear predictions as outlined in the reference manual. However, after reading several posts on obtaining predicted probabilities, none of the commands appear to work.

    I have attempted to use both predict( outcome(#)) and predict(pr) in the command line, however, neither option is allowed. My code is as such:

    Code:
    mi estimate, dots or: meqrlogit mviolence ib(6).age ib(1).nordic ib(3).incomeq ib(4).famdec cen_gii cen_unempg ib(1).partneremp(cen_sprotect cen_womeduc) || country: 
    mimrgns, predict(outcome(1)) at(partneremp=(0 1 2) cen_sprotect=(-544.1996 -272.0998 0 272.0988 544.1996)) cmdmargins
    Code:
    mi estimate, dots or: meqrlogit mviolence ib(6).age ib(1).nordic ib(3).incomeq ib(4).famdec cen_gii cen_unempg ib(1).partneremp(cen_sprotect cen_womeduc) || country: 
    mimrgns, at(partneremp=(0 1 2) cen_sprotect=(-544.1996 -272.0998 0 272.0988 544.1996)) ///
    predict(pr) cmdmargins
    *N.B. I cite cmdmargins to allow for marginsplot*

    Both commands, however, return the r(198) error that such an option is not allowed.

    Is there a way to obtain these predicted probabilities? Any suggestions would be much appreciated.

    Apologies for any inconvenience.

    Kind Regards,

    Patrick

  • #2
    N.B. My code is running an interaction. Apologies for the coding error. The code should read:

    Code:
     mi estimate, dots or: meqrlogit mviolence ib(6).age ib(1).nordic ib(3).incomeq ib(4).famdec cen_gii cen_unempg ib(1).partneremp##(cen_sprotect cen_womeduc) || country:
     mimrgns, at(partneremp=(0 1 2) cen_sprotect=(-544.1996 -272.0998 0 272.0988 544.1996)) /// predict(pr) cmdmargins

    Comment


    • #3
      mimrgns is (probably) from SSC, as you are asked to explain. Anyway, the reported problem has little to do with multiple imputation or the mimrgns command, as neither outcome(#) nor pr are valid options for the predict command or the margins command after meqrlogit (or melogit). See

      Code:
      help meqrlogit postestimation
      for available options. It seems margins does only accept the xb option after meqrlogit. You might be able to get predicted probabilities using the fixed part of the model, only, by typing

      Code:
      mimrgns , expression(exp(predict(xb))/(1+exp(predict(xb)))) ...
      This should be similar to the default prediction after meqrlogit, i.e. option mu with fixedonly.

      Best
      Daniel

      Comment


      • #4
        Dear Daniel,

        Many thanks for your swift response and advice. Apologies for the non-explanation. -mimrgns- is indeed from SSC. I'll be sure to try this code out, and report back.

        I had read somewhere (I believe it was the UCLA Statistical Consulting Group) about using the fixedonly option. However, I was somewhat confused by the coding. Many thanks, therefore, for providing the code for this.

        Kind Regards,

        Patrick

        Comment


        • #5
          Hi, I'm trying to compute predicted probabilities for 25 multiply imputed datasets after running meqrlogit using mimrgns. Is there a way to get the predicted probability for each individual in my sample (like a new column to the dataset), considering their values for each covariate? I would also need to add the fixed and random part of the intercept for each individual considering the group they are in... If my data was not multiply imputed, here is what I would do:

          HTML Code:
          meqrlogit diff_cat cc_ptjelect4 i.females cc_ses cc_household cc_expect2 i.depe ib2.gse i.master cc_est_mot cc_est_gusto cc_est_freq01 cc_est_freq02 cc_est_freq03 cc_est_freq04 cc_est_freq05 cc_est_info cc_est_chat cc_est_mail cc_est_foros cc_est_hw cc_est_explain cc_est_exam prof_read prof_write prof_hw prof_explain prof_exam || cod_curso:
          estimates save comp_full_qr, replace
          estimates store comp_full_qr
          
          predict fitted_xb, xb
          predict re_cod_curso, reffects
          gen intercept=-.5279427    
          gen pred_logit=fitted_xb + re_cod_curso + intercept
          gen pred_odds=exp(pred_logit)
          gen pred_prob=pred_odds/(pred_odds+1)
          gen predicted=.
          replace predicted=round(pred_prob, 1)
          Is it possible to do something similar using mimrgns?
          Many thanks!

          Comment


          • #6
            Since you are not using margins in the non-imputed scenario, you would probably not want mimrgns with imputed data. You want to look at

            Code:
            help mi predict
            and the associated pdf manual entry, too.

            Best
            Daniel
            ​​​​

            Comment

            Working...
            X