Announcement

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

  • table checking balance across covariates for two groups.

    Hi all,

    I am trying to create a small table where I test if covariates are balanced across two groups, called "gain" and "loss". I have done it for these two groups, which together add to my whole sample (as a test as I expect the covariates to be balanced). Here is the code I used.

    Code:
    label define loss 0 "Gain" 1 "Loss"
    label values loss loss
    *table1
    table1 , by(loss) vars(DonationCont conts \ DonationDic bin \donation_miss contn\  USA bin\  visit bin \  pasthighdonors bin) saving(table1_loss.xlsx, replace)
    Now I basically want to run similar tests in a table, but I am interested in doing it for two subgroups of my sample,lets call them "gain compliers" and "loss compliers". I cant seem to do it using by.. or maybe I am missing something easy here.


    Sorry in advance!



  • #2
    what is table1? a program you created?

    Should be able to "if gain_compliers==1" at some point.

    Comment


    • #3
      first, note that -table1- is a user-written program available at SSC - it is designed to be used to produce descriptive tables; note that there is a revised version, by a new author, called -table1_mc- and it is better but again not for checking balance

      second, neither -table1- nor any other statistical test producing p-values is a good choice for checking balance as the p-values will change, though the balance might not, as the sample size changes

      third, the -tebalance- command can be used with the "summarize" option but I'm not a fan as it produces both raw and "balanced" results; there are several user-written commands that might be helpful, including covbal, stddiff and pbalchk - use -search- to find and download
      Last edited by Rich Goldstein; 09 Mar 2023, 18:59.

      Comment


      • #4
        I normally use covbal or something I've written myself (pretty easy to code using tabstat). This table1 appears to estimate a means difference, which is not what you want. covbal can handle "if" statements which should get you home, but not sure you can export directly to excel.

        Comment

        Working...
        X