# How do I apply weights to a Cox Regression Model in R?

I am trying to answer the question of whether service in a certain organization has an effect on age of first marriage, and am interested in using the Cox model to understand the difference in the hazard rates.

Because I have observational data, I'm using a pre-processing technique to achieve covariate balance between the two groups (to account for selection bias), and then trying to estimate the treatment effect of service. Using the WeightIt package, each observation is given a weight, and I would now like to add these to the observations when conducting the Cox regression.

I was introduced to the coxphw package, but am unsure if I am putting the weights in the correct place. Currently, I am putting them in caseweights, where W1 is the object from the WeightIt package.

fit1 <- coxphw(Surv(time1mar, censor) ~ milserve,
data = com,
template = "ARE",
caseweights=get.w(W1))


Thanks for the help!