[R] weighted Cox proportional hazards regression

Terry Therneau therneau at mayo.edu
Wed Dec 5 14:22:21 CET 2007


> I'm getting unexpected results from the coxph function when using
> weights from counter-matching.  For example, the following code
> produces a parameter estimate of -1.59 where I expect 0.63:

  I agree with Thomas' answer wrt using offset instead of weight.  One way to 
understand this is to look at the score equation for the Cox model, which is
  	sum over the deaths of (x[i] - xbar[i])
x[i] is the covariate vector of the ith death
xbar[i] is the average of all the subjects who were at risk at the time of the 
ith death.

  In situations where one samples selected controls, the score equation will be 
correct if one fixes up xbar so that it is an estimate of the population mean 
(all those in the population that were at risk for a death) rather than being 
the mean of just those in the sample.  Use of an offset statement allows one to 
reweight xbar without changing the rest of the score equation.  It's kind of a 
trick, see Therneau and Li, Lifetime Data Analysis, 1999, p99-112 for a simple 
example of how it works.  Langholz and Borgan give details on exactly how to 
correctly reweight using some old results from sampling theory - it is just a 
little bit more subtle than one would guess, but not too different from the 
obvious.
  
  	Terry Therneau



More information about the R-help mailing list