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

  • "teffects psmatch" & "tebalance summarize" with multiple imputation

    Hello everyone,

    I am trying to complete a propensity score matching analysis using Stata's teffects psmatch command. I've completed the multiple imputation (MI) and I am able to complete the matching using the 'cmdok' option with mi estimate (because teffects psmatch is not officially supported in the MI environment):

    mi estimate, cmdok: teffects psmatch (outcome) (binary_exposure confounders), atet nneighbor(4) caliper(0.2) generate(matches)

    The issue that I am running into is that the generate(matches) option does not actually generate variable(s) specifying the observation numbers of the nearest neighbours that were matched. This option is required if you wish to perform post-estimation commands (i.e., tebalance summarize) based on the matching results. Therefore, I am wondering why generate(matches) is not working - and whether there is another way to make it work?

    I also tried running the teffects psmatch on a specific imputed dataset:

    mi xeq 1: teffects psmatch (outcome) (binary_exposure confounders), atet nneighbor(4) caliper(0.2) generate(matches)

    Again, generate(matches)failed to create any new variables in my dataset (not even within m=1, in this case).

    Overall, the inability to get
    generate(matches) to work (I also cannot get osample(unmatched) to work) means that I cannot use any of the tebalance post-estimation commands after completing my matching analyses. I want to look at the standardized mean differences within each imputed dataset, to be sure that there is adequate balance (which would mean that the summarized pooled estimate/variance came from imputed datasets where balance was achieved). However, I cannot do this if generate(matches) does not work.

    Any help would be much appreciated! Thank you,

  • #2
    Hello Francis, I ran into a same issue here as you described above. Have you figured it out the way to generate variables specifying the observations of treated and control group? Thanks.


    • #3
      In a nutshell, mi estimate does not handle options that create new variables such as teffect's generate() option. See the explanation for this at the end of this post. (Note that teffects is not officially supported by mi estimate.)

      To generate variables, matches in this example, you can use mi xeq, but you should make sure that you execute the command on the original data, m=0, too such as
      . mi xeq 0 1: teffects psmatch (outcome) (binary_exposure confounders), atet nneighbor(4) caliper(0.2) generate(matches)
      Typically, you would create matches in m=0 and all imputed data by simply prefixing your command with mi xeq:
      . mi xeq: teffects psmatch (outcome) (binary_exposure confounders), atet nneighbor(4) caliper(0.2) generate(matches)
      Warning! The generated variable containing matches is what Stata's mi suite defines as a super-varying variable. This means that this variable can vary in both complete and incomplete observations. Super-varying variables can exist only in MI styles flong and flongsep. You need to make sure that you use one of these styles before you run mi xeq: teffects ..., generate().

      Below is the explanation of why mi estimate does not create variables and, more generally, why it is important to generate new variables for m=0 first. I start with the latter. Stata's mi command verifies consistency of MI data each time any mi subcommand is run; see help mi update for details. One of the consistency checks is that the set of variables is the same across all data, original and imputed. The set of variables is determined by the original data, m=0. Variables that do not exist in m=0 are removed from all imputed data, m>0. When a new variable is created for one of the imputations but not for the original data, mi drops the "offending" variable during its checks. mi estimate does not run the estimation command on the original data (for speed) and so the specified new variable is never created in m=0.


      • #4
        Thank you Stata for the reply #3.

        I am using this guidance and have two questions:

        What's the difference between using option 1 and 2? Which is preferred and why?
        mi xeq 0 1: teffects psmatch (outcome) (binary_exposure confounders), atet nneighbor(4) caliper(0.2) generate(matches) 2.
        mi xeq: teffects psmatch (outcome) (binary_exposure confounders), atet nneighbor(4) caliper(0.2) generate(matches)

        Lastly, having adapted the above:
        mi xeq 0 1: teffects psmatch (outcome) (treatment cov1 cov2 cov3 cov4), generate(matches)

        I am still unable to use teffects box or teffects summarize as the generate(matches) is not working properly. Is there anyway to do this (check for balance) including MI?