Hello, i hope you can maybe help me.
I am trying to do a IPTW survival analysis adherent to the paper of Seisen et al.
https://www.researchgate.net/profile...-Data-Base.pdf
I first did a multiple imputation and subsequently, iptw. I created a graph with a comparison of values before and after weighting with the kernel density. After that, i basically did a cox regression test. My code is below. treatement in this case is "cn":
mi set flong
mi register imputed pt pn
mi impute chained (ologit) pt pn, add (15) replace augment noisily
mi xeq: logit cn; predict ps0, pr
mi xeq: logit cn age gender histo sarcomatoid pt pn mskcc; predict ps1 , pr
mi xeq: gen ipw= cn*(ps0/ps1) + ((1-cn)*((1-ps0)/(1-ps1)))
tempvar fw
gen `fw' = round((n*1000),1)
twoway (kdensity ps1 if cn==0 [fw=`fw'], bw(0.02) lpattern(solid) lwidth(medthick) lcolor("0 64 115")) (kdensity ps1 if cn==1 [fw=`fw'] , bw(0.02) lpattern(solid) lwidth(medthick) lcolor("220 169 31")), xtitle("Propensity Score", size (medlarge)) xlabel(0.4 0.6 0.8 1) ytitle("Kernel Density", size (medlarge)) ylabel(0 2 4 6 8 10, angle (horizontal)) legend(order (1 2) label(1 "No CN") label(2 "CN") cols (1)) legend(pos(2) ring(0)) graphregion(fcolor(white)) xtitle("propensity scores BEFORE matching") saving(before, replace)
tempvar fw
gen `fw' = round((ipw*1000),1)
twoway (kdensity ps1 if cn==0 [fw=`fw'], bw(0.02) lpattern(solid) lwidth(medthick) lcolor("0 64 115")) (kdensity ps1 if cn==1 [fw=`fw'] , bw(0.02) lpattern(solid) lwidth(medthick) lcolor("220 169 31")), xtitle("Propensity Score", size (medlarge)) xlabel(0.4 0.6 0.8 1) ytitle("Kernel Density", size (medlarge)) ylabel(0 2 4 6 8 10, angle (horizontal)) legend(order (1 2) label(1 "No CN") label(2 "CN") cols (1)) legend(pos(2) ring(0)) graphregion(fcolor(white)) xtitle("propensity scores AFTER matching") saving(after, replace)
graph combine before.gph after.gph, ycommon
mi stset timedeath [pweight = ipw], failure (css==1)
sts test cn
Problems:
1) Unfortunately, i have no idea how to do the rest of the graphs in the paper that my supervisor insists on. I looked everywhere, but can not find them. In paarticular, i dont know how to do the iptw-adjusted hazard ratio forrest plot, and Fig. A1 to depict the balancing through weighting.
2) I tried to do the standardised differences before and after Weighting. However, it does not seem to make a lot of difference:
Before:
. stddiff gender i.smoking histo sarcomatoid i.pt i.pn i.mskcc, by (cn) abs
------------------------------------------------------------------------------
| cn=0 | cn=1 |
| Mean or N SD or (%) | Mean or N SD or (%) | Std Diff
-------------+-------------------------+-------------------------+------------
gender | .2848 .45276 | .2308 .42337 | 0.12329
| | |
smoking | | |
1 | 19 (12.0) | 15 (14.4) | 0.20418
2 | 37 (23.4) | 19 (18.3) |
3 | 7 ( 4.4) | 2 ( 1.9) |
4 | 95 (60.1) | 68 (65.4) |
| | |
histo | .1772 .38306 | .1827 .38829 | 0.01420
sarcomatoid | .01899 .13691 | .1442 .35302 | 0.46778
| | |
pt | | |
0 | 43 (33.9) | 17 (16.5) | 0.61733
1 | 31 (24.4) | 13 (12.6) |
2 | 47 (37.0) | 63 (61.2) |
3 | 6 ( 4.7) | 10 ( 9.7) |
| | |
pn | | |
0 | 64 (52.5) | 27 (27.8) | 0.91122
1 | 48 (39.3) | 27 (27.8) |
2 | 10 ( 8.2) | 43 (44.3) |
| | |
mskcc | | |
0 | 48 (30.4) | 11 (10.6) | 0.56903
1 | 89 (56.3) | 64 (61.5) |
2 | 21 (13.3) | 29 (27.9) |
------------------------------------------------------------------------------
After:
------------------------------------------------------------------------------
| cn=0 | cn=1 |
| Mean or N SD or (%) | Mean or N SD or (%) | Std Diff
-------------+-------------------------+-------------------------+------------
gender | .2848 .45141 | .2308 .42145 | 0.12375
| | |
smoking | | |
1 | 304 (12.0) | 240 (14.4) | 0.20418
2 | 592 (23.4) | 304 (18.3) |
3 | 112 ( 4.4) | 32 ( 1.9) |
4 | 1520 (60.1) | 1088 (65.4) |
| | |
histo | .1772 .38193 | .1827 .38653 | 0.01425
sarcomatoid | .01899 .13651 | .1442 .35143 | 0.46980
| | |
pt | | |
0 | 803 (32.2) | 276 (16.6) | 0.54292
1 | 573 (22.9) | 211 (12.7) |
2 | 983 (39.4) | 1016 (61.1) |
3 | 138 ( 5.5) | 160 ( 9.6) |
| | |
pn | | |
0 | 1236 (49.6) | 474 (28.6) | 0.74497
1 | 953 (38.2) | 470 (28.4) |
2 | 303 (12.2) | 713 (43.0) |
| | |
mskcc | | |
0 | 768 (30.4) | 176 (10.6) | 0.56903
1 | 1424 (56.3) | 1024 (61.5) |
2 | 336 (13.3) | 464 (27.9) |
------------------------------------------------------------------------------
Do i miss something? Do i have to do the std differently to properly assess the effect of iptw?
3) How does weighting affect the median survival exactly? SInce after iptw, sts test automatically swithes to a cox regression instead of a log rank, i was not able to calculate the statistical difference in median survival
(Code: sts test cn if r(p50), logrank) <-- "logrank" was deleted for the weighted values.
I know i have a lot of questions. I tried to read it up myself, but as a not formally trained statistician, without help i dont know where to start or where to turn to.
i hope you can help me and am already greatful for every bit of advice.
Kind regards,
Florian
Related Posts with Problems with IPTW adjusted survival analysis
Conditional loop analysis with sums in panel dataI have an unbalanced data of company id (i) country code (c) year (y) ratio-1 (r1) ratio-2 (r2) …
PPML - generating a time dependent thresholdDear Stata community, I am working with a gravity model and what to cluster my observations dependi…
Determining the explanatory power of an interaction termHi everyone, I'm trying to fill a table with each line representing the explanatory power of a part…
Using a loop to calculate new variableHello all, I want to find the new sale price for each year represented through new_sales. I will us…
Generating dummy observations to balance a panelI hope this request makes sense, as it is just to aid in my estimation. Below is the dataex of a dum…
Subscribe to:
Post Comments (Atom)
0 Response to Problems with IPTW adjusted survival analysis
Post a Comment