Terry Therneau
2009-Nov-20 23:16 UTC
[R] How do I specify a partially completed survival analysis model
--- begin inclusion -- After I simulate Time and Censor data vectors denoting the censoring time and status respectively, I can call the following function to fit the data into the Cox model (a is a data.frame containing 4 columns X1, X2, Time and Censor): b = coxph (Surv (Time, Censor) ~ X1 + X2, data = a, method = "breslow"); Now the purpose of me doing simulation is that I have another mechanism to generate the number b2. From the given b2 (say it's 4.3), Cox model can be fit to generate b1 and check how feasible the new model is. Thus, my question is, how do I specify such a model that is partially completed (as in b2 is known). I tried things like Surv(Time,Censor)~X1+4.3*X2, but it's not working. Thanks very much. -----------end inclusion ---- 1. Use an offset argument. Anything therein is put into the linear predictor "as is". coxph(Surv(Time, Censor) ~ X1 + offset(X2*b2), data=a) 2. .... method='breslow' This never ceases to amaze me. The Efron approximation is uniformly superior to the Breslow -- that's why it is the default --- but the inferior method remains more popular to the point that people force the program to use it. I suppose because it was easier to program and thus was the first one implimented. However, for simulated data there will not be any ties in "time" so the two are identical. Terry Therneau