Hi everyone, I'm running a cox ph model on a dataset with a number of variables. Each variable has a different number of missing data, so that coxph() drops the individuals who are missing data at one or more variables. Because of this dropping (totally fine btw) I want to know how many events I am left with in the model. Is there a way of extracting them from the coxph() fit? or in any other reasonably efficient way? Best, Federico -- Federico C. F. Calboli Department of Epidemiology and Biostatistics Imperial College, St. Mary's Campus Norfolk Place, London W2 1PG Tel +44 (0)20 75941602 Fax +44 (0)20 75943193 f.calboli [.a.t] imperial.ac.uk f.calboli [.a.t] gmail.com
On 15 Jun 2010, at 18:34, Federico Calboli wrote:> I'm running a cox ph model on a dataset with a number of variables. Each variable has a different number of missing data, so that coxph() drops the individuals who are missing data at one or more variables. Because of this dropping (totally fine btw) I want to know how many events I am left with in the model. Is there a way of extracting them from the coxph() fit? or in any other reasonably efficient way?I just noticed that (survfit(coxmodel)) does work for a cox model with 1 only variable turned into a strata() (survfit(coxph(time, death) ~ strata(variable), data))) which does more or less what I need F -- Federico C. F. Calboli Department of Epidemiology and Biostatistics Imperial College, St. Mary's Campus Norfolk Place, London W2 1PG Tel +44 (0)20 75941602 Fax +44 (0)20 75943193 f.calboli [.a.t] imperial.ac.uk f.calboli [.a.t] gmail.com
On Jun 15, 2010, at 1:34 PM, Federico Calboli wrote:> Hi everyone, > > I'm running a cox ph model on a dataset with a number of variables. > Each variable has a different number of missing data, so that > coxph() drops the individuals who are missing data at one or more > variables. Because of this dropping (totally fine btw) I want to > know how many events I am left with in the model. Is there a way of > extracting them from the coxph() fit? or in any other reasonably > efficient way?Ideas: a) This is perhaps "cheating", but I use Harrell's rms function cph() which reports that number (as well as the number of missing from each variable) by default as part of the print()-ed version of the cph- object. b) I would have thought that summing events after applying complete.cases() to a subset containing just the variables of interest would have done the job, if you wanted to remain "true" to "survival". c) Or you could look at the older version of Harrell's work in the Design package to see how he extracted the event count, since I believe it made a call to cph(). d) Using the cph second example I seem to be getting success with assigning the results of coxph call to cox.obj and doing: > sum(cox.obj$y[,3]) [1] 7> > Best, > > Federico > > > -- > Federico C. F. CalboliDavid Winsemius, MD West Hartford, CT