Announcement

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

  • Presenting table 1 with iptw for categorical variables

    Hello all. I don’t know if this is stata list remit as this isn’t a code issue but really an idea

    I have used iptw using the following code below:

    Code:
    logit $treatment $covariatelist
    predict pscore_iptw
    
    //Create Propensity score weights
    //weight for control
    
    gen attweight=pscore_iptw/(1-pscore_iptw) if $treatment == 0
    
    //creating weight for treatment
    replace attweight = 1 if $treatment == 1
    
    //Apply weights to means
    mean $xlist if $treatment == 0 [pw=attweight] 
    
    //control
    mean $xlist if $treatment == 1 [pw=attweight] //treatment
    PROBLEM:

    i need to present my table 1. Similar to tiis
    https://www.researchgate.net/profile...adjustment.png

    Now I present the mean weights of a variable pre adjustment and post adjustment, this is easy with a continous variable as I only have 1 value ie 1 mean weight, and even more so with a categorical variable with 2 levels, as one of these is the reference [1]

    QUESTION:
    How do I present the weights for the different levels of a categorical variable with more than 2 levels eg ASA , which has 3 levels ASA1 ASA2 ASA3. Asa is a part of the global macro $covaristelist

    a colleague advised me to use -svyset- in this way
    webuse nhanes2
    svyset psu [pweight=finalwgt], strata(strata) vce(linearized)
    singleunit(missing)
    svy: tab region


    however, I don’t see how the above can be related to the way I generate the attweight p weights above.

    or pwrhaps in your experience how should I present table 1 following iptw ?
Working...
X