I've used the
twang package to calculate propensity score weights in my observational data set. The
twang vignette uses the
survey package to apply the weighted PS in analyses, but does not provide an example for Cox proportional hazard estimation.
survey package provides a function called
svycoxph() which which seems to do the trick. However, when i use
coxph() from the
survival package an set the
weight= argument to the extracted weighted PS from
ps() object i get an indentical HR estimate, albeit a much more narrow 95%CI.
Can I use the extracted propensity score weights from a ps object from the
twang package as a vector in the
weight= argument of the
Should i include an example?
Update: When i added a
cluster(patient ID) term in the the
coxph formula, both the HR and the 95% CI became identical to the
syvcoxph output. So I guess that did the trick. But can i conclude that this is ok to use?