On Tue, 5 Dec 2006, Michael McCulloch wrote:
> Thank you to all who made very helpful suggestions to get started with R.
> Duncan Murdoch raised an excellent question, asking about my background and
> reason for using R. I'm an epidemiologist, applying the marginal
structural
> models approach (inverse probability of treatment weights) in a Cox
> proportional hazards analysis.
>
> The statistical program which I had been using does not have functions for
> doing a weighted Cox analysis. Any advice pointing me in the direction of
> resources to help probability-of-treatment-weighted Cox proportional
> hazards would be most appreciated.
You can do IPW estimation with the coxph() function in the 'survival'
package as long as you use the `robust=TRUE' option for standard errors.
The weights can be supplied as weights to coxph().
You need to fit logistic regression models for treatment, with glm(),
then use predict() to get probabilities of treatment (yes/no) then convert
these into probability of observed treatment, then take the reciprocal to
get the weights.
How messy this all is depends on the data structure -- how regular the
observations of 'treatment' are, for example -- since this determines
how
many different logistic models for treatment you will need.
-thomas
Thomas Lumley Assoc. Professor, Biostatistics
tlumley at u.washington.edu University of Washington, Seattle