Survival analysis using marginal-structural-model methodology requires that weights (pweights=inverse of the propensity score for treatment=IPW) are allowed to vary per time point per individual.
So:
using this e.g. data
gives the error "weights not constant within ID variable id".
A workaround would be to not use survival analysis but its approximate equivalent: "pooled logistic regression" (results in duplicating rows of data to emulate the time structure) - but that comes with its own problems...
Perhaps I'm missing something - IS there a way Stata could somehow handle per-panel-varying-weights?
Best
Stefan
So:
Code:
stset time [pweight=varying_weight], failure(death) id(id)
Code:
clear input float(id death time x varying_weight stable_weight) 1 0 1 .3488717 .3333333 .3 1 0 2 .2668857 .5 .3 1 1 3 .8689333 .2 .3 2 0 1 .3508549 1 .5 2 0 2 .07110509 .5 .5 2 0 3 .32336795 .25 .5 2 0 4 .5551032 .2 .5 2 1 5 .875991 .2 .5 3 0 1 .20470947 .25 .4 3 0 2 .8927587 .5 .4 3 0 3 .5844658 .25 .4 3 0 4 .3697791 .3333333 .4 3 1 5 .8506309 1 .4 end
A workaround would be to not use survival analysis but its approximate equivalent: "pooled logistic regression" (results in duplicating rows of data to emulate the time structure) - but that comes with its own problems...
Perhaps I'm missing something - IS there a way Stata could somehow handle per-panel-varying-weights?
Best
Stefan
Comment