B is the specification for time-varying covariates. Otherwise, your model will think that each row is one independent observation that either had an event or was censored at "time" or "total_time."
HTH, Daniel javier palacios wrote: > > Dear R-community, > > which of the following two formats is correct? Are both correct? > > Please, consider this example: > > data table: > > Data > S sta time TDC1 total_time > A 1 0 1 48.50 1 > B 0 0 1 65.96 2 > B 1 1 2 65.08 2 > C 0 0 1 0.00 2 > C 1 1 2 0.00 2 > D 0 0 1 72.74 2 > D 1 1 2 72.52 2 > E 0 0 1 61.84 2 > E 0 1 2 60.56 2 > F 0 0 1 35.04 4 > F 0 1 2 36.97 4 > F 0 2 3 37.92 4 > F 1 3 4 39.01 4 > > time - time to event > sta - starting time > TDC - time dependent covariates > total_time - total time at risk > > option A > > coxph(Surv(time,S) ~ time_dependent_covariates, > data=data.frame(Data)) > > option B > > coxph(Surv(sta,time,S) ~ time_dependent_covariates, > data=data.frame(Data)) > > option C > > coxph(Surv(total_time,S) ~ time_dependent_covariates, > data=data.frame(Data)) > > > How can time at risk be visualized in the coxph output? > > Best regards, > > Javier > -- View this message in context: http://r.789695.n4.nabble.com/COXPH-TIME-DEPENDENT-tp3754837p3755852.html Sent from the R help mailing list archive at Nabble.com. ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.