Announcement

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

  • Assessing covariate balance on indicator variables using the -tebalance summarize- command

    Hi all,

    After running most of the estimating commands from the -teffects- family, one can then assess balancing of the raw and weighted samples using the -tebalance summarize- command.

    However, I am trying to understand the output for indicator variables specifically using this command.

    For example, using the following data:
    Code:
    * Example generated by -dataex-. To install: ssc install dataex
    clear
    input float group long sex double age long operation float primary
    1 2 66 3 1
    0 2 67 3 0
    0 2 76 3 0
    1 1 72 3 0
    0 1 79 4 0
    0 2 71 1 1
    1 1 58 4 0
    1 2 68 3 0
    0 2 49 4 0
    0 2 67 3 1
    1 2 60 3 0
    1 2 70 3 1
    1 2 71 1 1
    1 2 65 3 0
    1 2 77 3 1
    0 2 58 3 1
    0 2 63 3 0
    1 1 86 1 1
    0 2 63 3 1
    0 2 73 3 0
    1 1 62 4 1
    0 1 65 3 0
    0 2 61 1 0
    0 2 71 3 0
    0 2 61 3 0
    0 2 70 2 0
    1 2 84 3 1
    1 2 54 3 0
    1 1 74 1 0
    0 1 56 3 0
    1 1 67 3 0
    1 2 64 3 1
    1 2 57 3 0
    0 2 70 3 0
    0 2 62 3 1
    1 1 70 4 0
    1 2 62 1 0
    0 2 57 3 0
    1 2 65 1 1
    0 2 73 3 0
    0 2 73 3 0
    0 1 61 3 1
    1 2 66 3 0
    1 2 82 1 0
    0 2 68 3 0
    1 2 74 3 1
    1 2 63 3 0
    1 2 65 3 0
    1 2 73 3 0
    0 2 69 3 0
    0 2 73 3 0
    1 2 60 3 0
    0 2 67 4 1
    0 1 55 4 1
    1 1 68 3 0
    1 2 58 3 1
    0 2 77 3 1
    1 2 67 3 0
    0 2 85 3 0
    0 2 68 3 1
    0 1 66 4 0
    1 2 64 3 0
    1 2 70 3 1
    0 2 61 3 0
    0 1 80 3 0
    0 2 67 3 0
    0 1 68 3 1
    1 2 76 3 1
    1 2 74 3 0
    0 1 79 3 0
    1 2 52 3 0
    1 2 80 3 1
    1 2 58 3 0
    0 2 58 3 0
    1 2 57 3 0
    1 2 71 1 0
    0 2 77 3 1
    0 2 81 3 0
    0 2 63 3 0
    0 2 60 3 0
    1 2 67 2 0
    0 2 57 4 0
    1 2 74 3 1
    1 2 66 3 1
    1 2 55 3 0
    1 2 56 3 1
    1 2 60 3 0
    1 2 63 3 0
    0 2 59 3 0
    0 1 60 3 0
    0 2 57 3 0
    0 1 80 3 1
    1 2 72 3 0
    0 2 42 3 0
    0 2 57 3 1
    1 1 67 4 1
    0 2 25 4 0
    1 2 74 3 0
    0 2 66 3 0
    1 2 44 3 1
    end
    label values group treatment
    label def treatment 0 "isoflurane", modify
    label def treatment 1 "sevoflurane", modify
    label values sex sex
    label def sex 1 "Female", modify
    label def sex 2 "Male", modify
    label values operation operation
    label def operation 1 "CABG + valve repair/replacement", modify
    label def operation 2 "CABG, OFF-pump", modify
    label def operation 3 "CABG, ON-pump", modify
    label def operation 4 "Single valve repair/replacement", modify
    label var group "randomization group"
    label var sex "sex"
    label var age "patient's age"
    label var operation "operation type"
    label var primary "Primary outcome (ICU LOS >= 2d or 30d mortality)"
    Where "operation" is a multi-level indicator variable as such:
    Code:
    Numeric      Label
    1            CABG + valve repair/replacement
    2            CABG, OFF-pump
    3            CABG, ON-pump
    4            Single valve repair/replacement
    I issue these commands:
    Code:
    teffects ipw (primary) (group i.sex c.age i.operation, logit)
    tebalance summarize
    and obtain the following result from the -tebalance summarize- command:
    Code:
      Covariate balance summary
                                                       Raw     Weighted
                              -----------------------------------------
                              Number of obs =          100        100.0
                              Treated obs   =           50         50.0
                              Control obs   =           50         50.0
                              -----------------------------------------
    
      -----------------------------------------------------------------
                      |Standardized differences          Variance ratio
                      |        Raw    Weighted           Raw   Weighted
      ----------------+------------------------------------------------
                  sex |
                Male  |   .0991189    -.030093      .8601399   1.046878
                      |
                  age |   .1194342    .0269028      .6448423   .6807031
                      |
            operation |
      CABG, OFF-pump  |          0   -.0000509             1    .999641
       CABG, ON-pump  |   -.095702   -.0021854          1.14   1.002942
      Single valve~t  |  -.1907122    .0059734      .6112957   1.014956
      -----------------------------------------------------------------
    But, this doesn't show me the standardized difference for the first level of the indicator variable "operation". Does anyone have any suggestions as to how I might be able to get the standardized differences for, in this example, " CABG + valve repair/replacement" which is level 1 of the indicator?

    Many thanks, Phil

  • #2
    Hi Philip,

    If you don't specify a variable list with tebalance summarize, the command will take the variables as specified in the model. Since variable operation is specified as a factor variable with a base level, the base level will be omitted in tebalance summarize, too. In order to obtain differences for all indicators, you can specify the variable operation to have no base level by using the ibn. operator:

    Code:
    . tebalance summarize ibn.operation
    
      Covariate balance summary
                                                       Raw     Weighted
                              -----------------------------------------
                              Number of obs =          100        100.0
                              Treated obs   =           50         50.0
                              Control obs   =           50         50.0
                              -----------------------------------------
    
      -----------------------------------------------------------------
                      |Standardized differences          Variance ratio
                      |        Raw    Weighted           Raw   Weighted
      ----------------+------------------------------------------------
            operation |
      CABG + valve~t  |   .3513199   -.0033712      3.135417   .9903206
      CABG, OFF-pump  |          0   -.0000509             1    .999641
       CABG, ON-pump  |   -.095702   -.0021854          1.14   1.002942
      Single valve~t  |  -.1907122    .0059734      .6112957   1.014956
      -----------------------------------------------------------------
    Joerg

    Comment


    • #3
      Many thanks for this very helpful response Joerg! Although I have been using factor variables since they became available, I had forgotten about this notation. I do wonder if it is worthwhile including this case (i.e., computing standardized differences for a multi-level categorical variable) in the PDF documentation?

      Comment


      • #4
        I have a problem myself correcting for unbalanced covariates when the treatment variable has 6 levels

        Comment

        Working...
        X