Announcement

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

  • Using mi estimate with any command

    The formulas implemented by -mi estimate:- apply to any efficient estimator, but -mi estimate:- only supports a limited number of commands. Is there a a tool for calculating multiple imputation estimates from a command that -mi estimate:- does not support? Examples include the -corr- command and the -sem- command.

    I can implement the formulas "by hand," but I'm wondering if there's a more a convenient way. -mi estimate:- is awfully convenient for the commands that it supports.

  • #2
    Originally posted by paulvonhippel View Post
    The formulas implemented by -mi estimate:- apply to any efficient estimator,
    I am not sure about that. There are certain assumptions involved. For example, the estimated quantity should be a population parameter (no p-values or the like) and it should be (approximately) normal. The latter is probably not true for correlation (or standardized regression) coefficients. You probably know more about that than I do. I mention these concerns for others that find this thread and might be interested. The underlying idea is that sometimes there are (good) reasons why Stata does not do something.

    Anyway, technically, you can add the cmdok option to mi estimate as in

    Code:
    mi estimate , cmdok : sem ...
    to get a combined coefficient vector and covariance matrix. This works for e-class commands (most estimation commands), such as sem, that store the coefficient vector and the covariance matrix in e(b) and e(V), respectively. For r-class commands, such as correlate, you would need to set up a warpper program along the lines

    Code:
    program mi_correlate , eclass properties(mi)
        correlate `0'
        
        ...
        
        ereturn post `b' `V' ...
    end
    that returns the coefficients and covariance matrix where mi estimate expects them. You call your program as

    Code:
    mi estimate : mi_correlate ...
    where you do no longer need the cmdok opinion. Techincal hint: the first argument of mi_correlate must not be void/empty.
    Last edited by daniel klein; 02 Nov 2020, 23:09.

    Comment


    • #3
      Fabulously helpful, daniel klein . How did I not know about the -cmdok- option?

      Comment


      • #4
        The cmdok option is documented in

        Code:
        help mi estimate
        Look under the sub-heading Advanced options.

        Comment


        • #5
          Originally posted by daniel klein View Post

          I am not sure about that. There are certain assumptions involved. For example, the estimated quantity should be a population parameter (no p-values or the like) and it should be (approximately) normal. The latter is probably not true for correlation (or standardized regression) coefficients. You probably know more about that than I do. I mention these concerns for others that find this thread and might be interested. The underlying idea is that sometimes there are (good) reasons why Stata does not do something.

          Anyway, technically, you can add the cmdok option to mi estimate as in

          Code:
          mi estimate , cmdok : sem ...
          to get a combined coefficient vector and covariance matrix. This works for e-class commands (most estimation commands), such as sem, that store the coefficient vector and the covariance matrix in e(b) and e(V), respectively. For r-class commands, such as correlate, you would need to set up a warpper program along the lines

          Code:
          program mi_correlate , eclass properties(mi)
          correlate `0'
          
          ...
          
          ereturn post `b' `V' ...
          end
          that returns the coefficients and covariance matrix where mi estimate expects them. You call your program as

          Code:
          mi estimate : mi_correlate ...
          where you do no longer need the cmdok opinion. Techincal hint: the first argument of mi_correlate must not be void/empty.
          Dear Daniel,
          Thank you for your post. I have tried to write an mi_correlate program and estimated the correlation between two variables after multiple imputation. Stata did not report any error but did not return any results either. What could be wrong in my code as follows? Thanks in advance.

          program mi_correlate , eclass properties(mi)
          correlate `0'

          mi estimate: mi_correlate PictureNamingETnoun PictureNamingETverb

          ereturn post `b' `V'
          end

          Comment


          • #6
            I was pointing to the general possibility of writing such a program. I have omitted all the relevant details. Because you did not fill in any details either, your program does not work. I am sorry but developing the program in all details is beyond what I wanted to do here.

            mibeta (from http://www.stata.com/users/ymarchenko) or this discussion might be useful.

            Comment

            Working...
            X