Paul Miller
2012-Jul-13 15:17 UTC
[R] Power analysis for Cox regression with a time-varying covariate
Hello All, Does anyone know where I can find information about how to do a power analysis for Cox regression with a time-varying covariate using R or some other readily available software? I've done some searching online but haven't found anything. Thanks, Paul
Greg Snow
2012-Jul-13 20:29 UTC
[R] Power analysis for Cox regression with a time-varying covariate
For something like this the best (and possibly only reasonable) option is to use simulation. I have posted on the general steps for using simulation for power studies in this list and elsewhere before, but probably never with coxph. The general steps still hold, but the complicated part here will be to simulate the data. I would recommend something along the lines of: 1. generate a value for the censoring time, possibly exponential or weibull (for simplicity I would make this not dependent on the covariates if reasonable). 2. generate a value for the covariate for the given time period (sample function possibly), then generate a survival time for this covariate value (possibly weibull distribution, or lognormal, exponential, etc.) If the survival time is less than the time period and censoring time then you have an event and a time to the event. If the survival time is longer than the censoring time, but not longer than the time period (for the covariate), then you have censoring and you can record the time to censoring. If the survival time is longer than the time period then you have the row information for that time period and can move on to the next time period where you will first randomly choose the covariate value again, then generate another survival time based on the covariate and given that they have already survived a given amount. Continue with this until you have an event or censoring time for each subject. On Fri, Jul 13, 2012 at 9:17 AM, Paul Miller <pjmiller_57 at yahoo.com> wrote:> Hello All, > > Does anyone know where I can find information about how to do a power analysis for Cox regression with a time-varying covariate using R or some other readily available software? I've done some searching online but haven't found anything. > > Thanks, > > Paul > > ______________________________________________ > R-help at 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.-- Gregory (Greg) L. Snow Ph.D. 538280 at gmail.com
Terry Therneau
2012-Jul-18 13:24 UTC
[R] Power analysis for Cox regression with a time-varying covariate
Marc gave the referencer for Schoenfeld's article. It's actually quite simple. Sample size for a Cox model has two parts: 1. Easy part: how many deaths to I need d = (za + zb)^2 / [var(x) * coef^2] za = cutoff for your alpah, usually 1.96 (.05 two-sided) zb = cutoff for power, often 0.84 = qnorm(.8) = 80% power var(x) = variance of the covariate you are testing. For a yes/no variable like treatment this would be p(1-p) where p = fraction on the first arm coef = the target coefficient in your Cox model. For an "increase in survival of 50%" we need exp(coef)=1.5 or coef=.405 All leading to the value I've memorized by now of (1.96 + 0.84)^2 /(.25* .405^2) = 191 deaths for a balanced two arm study to detect a 50% increase in survival. 2. Hard part: How many patients will I need to recruit, over what interval of time, and with how much total follow-up to achieve this number of events? I never use the canned procedures for sample size because this second part is so study specific. And frankly, it's always a guesstimate. Death rates for a condidtion will usually drop by 1/3 as soon as you start enrolling subjects. Terry T.
Reasonably Related Threads
- Cox Proportional Hazards model with a time-varying covariate
- Survival Analysis Daily Time-Varying Covariate but Event Time Unknown
- testing proportional hazard in a Cox model including a time-varying covariate
- A question on time-dependent covariates in the Cox model.
- Cox Proportional Hazard with missing covariate data