[R] Schoenfeld residuals for a null model coxph

Terry Therneau therneau at mayo.edu
Fri Feb 24 15:05:23 CET 2012


---- begin included message ---
I have a coxph model like

coxph(Surv(start, stop, censor) ~ x + y, mydata)

I would like to calculate the Schoenfeld residuals for the null, i.e the
same model where the beta hat vector (in practical terms, the coeff
vector spat out by summary()) is constrained to be all 0s --all lese
stays the same. 

----- end inclusion ---

You can get the fit for any coefficient you want by setting the initial
values and asking for 0 iterations.

  fit0 <- coxph(Surv(start, stop, censor) ~ x + y, mydata, 
	    init=c(0,0), iter=0)
  resid(fit0, type='schoenfeld')

Terry Therneau



More information about the R-help mailing list