Announcement

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

  • -mi estimate: melogit- : is it legit?

    The documentation for -mi estimate- does not include -melogit- in the list of supported estimation commands. Likewise, -melogit- does not list -mi estimate- as an acceptable prefix.

    However, I tried the combination and there were no complaints; -mi estimate- is dutifully running through the imputation models. Should I doubt the results? Or should I doubt the documentation?

    Notably, -mi estimate- is documented as supporting -meqrlogit- which estimates the same models, but when I tried this with -mi estimate- it ran for several days without completing a single imputation estimate, so I abandoned the effort (the -melogit- model takes about 5-10 minutes).

    cheers,
    Jeph

  • #2
    What was the mi estimate command? Did it include the -cmdok- option? I'd be surprised if you didn't have to add cmdok for a command that is not listed as supported.
    -------------------------------------------
    Richard Williams, Notre Dame Dept of Sociology
    StataNow Version: 19.5 MP (2 processor)

    EMAIL: [email protected]
    WWW: https://www3.nd.edu/~rwilliam

    Comment


    • #3
      Did not use -cmdok-.

      mi estimate, saving(model) dots : melogit ....

      Last edited by Jeph Herrin; 15 Jul 2016, 09:20.

      Comment


      • #4
        The properties for melogit.ado do not include -mi-, so I don't know why it is working for you. I am guessing you are ok but I don't know for sure.
        -------------------------------------------
        Richard Williams, Notre Dame Dept of Sociology
        StataNow Version: 19.5 MP (2 processor)

        EMAIL: [email protected]
        WWW: https://www3.nd.edu/~rwilliam

        Comment


        • #5
          Hi Jeph and Richard,

          I'm wondering if you have come across more information since the last post on 7/2016 regarding whether -melogit- is a legitimate command to use with -mi estimate-. The current documentation does not include -melogit- in the list of supported estimation commands as Jeph mention previously. I am using Stata 14.2.

          Thanks,

          Tom

          Comment


          • #6
            I don't know why it works (assuming it does; I am trusting Jeph here). It isn't documented and melogit.ado does not seem to have the necessary properties. I'm also not sure why mi would be inappropriate for melogit, especially since other me commands are explicitly supported.
            -------------------------------------------
            Richard Williams, Notre Dame Dept of Sociology
            StataNow Version: 19.5 MP (2 processor)

            EMAIL: [email protected]
            WWW: https://www3.nd.edu/~rwilliam

            Comment


            • #7
              I had some exchanges with Stata regarding the problem; they said that it was a bug that -mi estimate- didn't complain about -melogit-, and they would add to their fix list. More helpfully (for you and for me), I eventually received the following suggested solution, which I hope Isabel does not mind my sharing:

              -mi estimate- is not intended to work with -melogit-, but it works
              with -meqrlogit-. You can force -mi estimate- to run with -melogit-
              with the command -cmdok-, though there will be some differences in
              the results. That is, if you write:

              mi estimate, cmdok: melogit .....

              you will get some results. I want to explain why those results are not
              quite accurate, and how to correct them.

              When you use -mi estimate, cmdok: melogit- you will get appropriate
              estimates for the coefficients, the constant, and reasonable estimates
              for the variance components. You will get appropriate
              estimates for the confidence intervals for the fixed effects also.
              The problem are the CI for the variance components. I you don't care
              about them, you can use just -mi estimate, cmdok: melogit-.

              When you use -mi estimate:meqrlogit-, (I mean, when -meqrlogit- works)
              there is special code on -mi estimate- to combine the variance components
              in the estimation metric. The point is that Rubin's rules should be applied
              to values in a metric that produce values with a distribution as normal
              as possible, and this is not the case of the variance 'as is'.

              The way to solve this is to write a wrapper for -melogit- that returns
              the values as ln(sd). This is easy thanks to -nlcom-. Please look at the
              following example, and let me know if you have any questions.

              If you want to see how to name the parameters with -nlcom- after -melogit-,
              you can call -melogit, coeflegend- after an estimation.
              In the code below, the -mi estimate: meqrlogit- line and the
              -mi estimate: melogit line are there to provide
              comparison points. You will see that your final CI is more in line
              with -meqrlogit- provides than when you use -mi estimate: melogit-

              ********** begin code
              capture log close
              cscript
              log using mylog, text replace
              set seed 13579

              use towerlondon, clear

              *** create some missing data and imputed data
              replace difficulty = . if runiform()<.3
              mi set wide
              mi register imputed difficulty
              mi register regular dtlm group
              mi impute mlogit difficulty dtlm i.group, add(5)

              *estimate with mi: meqrlogit, this are the 'good' estimates
              mi estimate, variance: meqrlogit dtlm difficulty || family:

              * estimate with mi:melogit; you will see big differences on the
              * CI for the variance component
              mi estimate, cmdok: melogit dtlm difficulty || family:


              * create a wrapper
              program myprog, eclass
              melogit dtlm difficult || family:
              nlcom (difficulty:_b[dtlm:difficulty]) ///
              (lns_fam:log(sqrt(_b[var(_cons[family]):_cons]))), post
              end

              *apply Rubin's rules in the ln(sqrt(var)) metric
              mi estimate, cmdok saving(myest, replace) : myprog

              log close

              ********** end code

              After that, you just back-transform the confidence limits for -lns-,
              for example if you have:

              ------------------------------------------------------------------------------
              dtlm | Coef. Std. Err. t P>|t| [95% Conf. Interval]
              -------------+----------------------------------------------------------------
              difficulty | -1.353544 .2169167 -6.24 0.000 -1.806032 -.9010564
              lns_fam | -.0501702 .2561532 -0.20 0.845 -.5526212 .4522807
              ------------------------------------------------------------------------------

              then you write:
              di exp(2*-.5526212)
              di exp(2*.4522807)

              There are more elegant ways to do it, but now I just want you
              to get this working.

              Let me know if you have any questions about this process, or any
              implementation issues.

              Sincerely,

              Isabel


              Isabel Canette, Ph.D.
              Principal Mathematician & Statistician
              StataCorp LP

              Comment


              • #8
                Thanks Jeph. Although it would be nice if Stata just automated all this for you so you didn't have to do the workaround. But if you aren't a fanatic about getting the CIs right for the variance components, it sounds like MI is good enough.
                -------------------------------------------
                Richard Williams, Notre Dame Dept of Sociology
                StataNow Version: 19.5 MP (2 processor)

                EMAIL: [email protected]
                WWW: https://www3.nd.edu/~rwilliam

                Comment


                • #9
                  Thank you Richard and Jeph for your quick reply.

                  Jeph, regarding your exchange with Stata:

                  they said that it was a bug that -mi estimate- didn't complain about -melogit-, and they would add to their fix list.
                  Do you mean that Stata would add an error statement after running -mi estimate- that would complain about -melogit- not fulfilling the requirements of -mi estimate-? Or do you mean that Stata would include -melogit- as one of the estimation commands that would be supported by -mi estimate-?

                  Thanks,

                  Tom

                  Comment


                  • #10
                    Originally posted by Tom Weichle View Post
                    Thank you Richard and Jeph for your quick reply.

                    Jeph, regarding your exchange with Stata:



                    Do you mean that Stata would add an error statement after running -mi estimate- that would complain about -melogit- not fulfilling the requirements of -mi estimate-? Or do you mean that Stata would include -melogit- as one of the estimation commands that would be supported by -mi estimate-?

                    Thanks,

                    Tom
                    They would add an error message.

                    Comment

                    Working...
                    X