IPTW survival analysis with crossed KM

i am new here but i have the feeling, i will be around for some time. Off to my question now :)

I am currently doing a survival analysis between two groups of patients that either received an event (surgery) or not. I want to find out, how this affects different survival endpoints. Now i did all regular analyses with KM, COx regression etc.
Now i want to do an inverse probability treatment weighting and recalculate the association on survival. I calculated the ITPW and wanted did some KMs, but i can not find the proper way to calculate for significance.
First, i used stata:

stset timedeath [pw=iptw], fail(css)
sts graph, by(cn)
sts test (cn)

In this, stata switched to cox regression naturally, which is fine. However, proportional hazard assumption is significant (estat phtest) and visibly, the KM curves cross multiple times. I did some digging and found out, that Renyis test is good for crossing KMs. So i switched to R. But i could not find a way to include the IPTW in the survMisc package command for Renyis test.

data("nciptw", package="survMisc")
g1 <- ten(Surv(time, event) ~ group, data=ncitpw)

I did try the IPWsurvival package in R as well, but i am not sure it is feasable when dealing with crossed KM curves.


can someone maybe help me? Is there a way to incorporate the IPTW in the survMisc package? is IPWsurvival a correct way to do this? or is there another way in stata or R to get the necessary results?

I would be very glad, if someone could help me. And i hope this is in the right subsection. I am more than happy to provide additional information.

I wish you a great rest of the week for now :)



Not a robit
At this point I have only used IPTW in SAS and was able to add a "weight = ???" option, given I did not have the crossing you mentioned or nothing out of the ordinary. I wonder if it has a weight option. Remind me of why you are concerned about the crossing, is that related to the proportionality of hazard assumption in PHREG - I don't regularly run survival type analyses.

P.S., Welcome to the Forum
Yes, in part. Basically, because of the weighting, the Kaplan-Meier estimates cross repreatedly. From what i take, this is the reason why the proportional hezard assumption is significant. This makes sense to me, as in crossing curves, you cant make an assumption about superiority of one treatment over the other, even visually and not necessarily any assumptions about wether the difference is statistically signfiicant. You could say, well in the beginning, this one is superior, then the other one for two months etc. Something like Renyis test takes this into account, but has its own weightings that for example, either favour the earlier or later part of survival to show wether there is a difference between treatments. From that point of you, i hope that the IPTWsurvival package in R covers crossing Kaplan-Meier estimates, since i guess this regular happens after applying IPTW.