Re: [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. __ 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.
Re: [R] Power analysis for Cox regression with a time-varying covariate
Hi Terry, Greg, and Marc, Thanks for your advice about this. I think I have a pretty good starting point now for the analysis. Appreciate your help. Paul --- On Wed, 7/18/12, Terry Therneau thern...@mayo.edu wrote: From: Terry Therneau thern...@mayo.edu Subject: Re: [R] Power analysis for Cox regression with a time-varying covariate To: Marc Schwartz marc_schwa...@me.com, Greg Snow 538...@gmail.com, r-help@r-project.org, Paul Miller pjmiller...@yahoo.com Received: Wednesday, July 18, 2012, 8:24 AM 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. [[alternative HTML version deleted]] __ 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.
Re: [R] Power analysis for Cox regression with a time-varying covariate
One quick (though probably not canned) approach to get a feel for what an analysis might be like is to analyze a sample data set (from the survival package, a textbook, or a past analysis). Choose something that has some similarity to the planned study. Now look at the widths of the confidence intervals from that analysis, that will give a feel for the effect size that can be detected using the same sample size. You could also analyze a subset of the data to see what a smaller sample size would give and you could sample with replacement to get a larger sample and analyze that to get a feel for larger data sets (this will be more approximate than the others since you will be reusing subjects and so they won't be as different from each other as in a true data set). Terry has also indicated that whether the predictors vary with time or not should not affect the power/sample size calculations, so if you have a canned approach (or just simpler approach) for non-varying predictors then you could just use that. On Sun, Jul 15, 2012 at 8:02 AM, Paul Miller pjmiller...@yahoo.com wrote: Hi Greg, Thanks for your response. So far I've just been asked to investigate what the analysis likely would involve. The hope was that there were be some sort of quick and easy canned approach. I don't really think this is the case though. If I'm asked to do the actual analysis itself, I'll start out using the steps you've listed and see where that takes me. Paul --- On *Fri, 7/13/12, Greg Snow 538...@gmail.com* wrote: From: Greg Snow 538...@gmail.com Subject: Re: [R] Power analysis for Cox regression with a time-varying covariate To: Paul Miller pjmiller...@yahoo.com Cc: r-help@r-project.org Received: Friday, July 13, 2012, 3:29 PM 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...@yahoo.comhttp://ca.mc1616.mail.yahoo.com/mc/compose?to=pjmiller...@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@r-project.orghttp://ca.mc1616.mail.yahoo.com/mc/compose?to=R-help@r-project.orgmailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.htmlhttp://www.r-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Gregory (Greg) L. Snow Ph.D. 538...@gmail.comhttp://ca.mc1616.mail.yahoo.com/mc/compose?to=538...@gmail.com -- Gregory (Greg) L. Snow Ph.D. 538...@gmail.com [[alternative HTML version deleted]] __ 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.
Re: [R] Power analysis for Cox regression with a time-varying covariate
Hi Greg and Paul, I had initially contemplated a solution similar to Greg's, which is simulation. However, I might just throw out, that if based upon Terry's comments, time varying covariates do not impact the power/sample size considerations for the Cox model, then Schoenfeld's 1983 article in Biometrics would be of value: Sample-Size Formula for the Proportional-Hazards Regression Model David A. Schoenfeld Biometrics, Vol. 39, No. 2. (Jun., 1983), pp. 499-503. Another reference would be: Sample-Size Calculations for the Cox Proportional Hazards Regression Model with Nonbinary Covariates F.Y. Hsieh and Philip W. Lavori Controlled Clinical Trials 21:552–560 (2000 A skillful Google search will find both available online if you don't have access otherwise. Regards, Marc Schwartz On Jul 17, 2012, at 12:33 PM, Greg Snow wrote: One quick (though probably not canned) approach to get a feel for what an analysis might be like is to analyze a sample data set (from the survival package, a textbook, or a past analysis). Choose something that has some similarity to the planned study. Now look at the widths of the confidence intervals from that analysis, that will give a feel for the effect size that can be detected using the same sample size. You could also analyze a subset of the data to see what a smaller sample size would give and you could sample with replacement to get a larger sample and analyze that to get a feel for larger data sets (this will be more approximate than the others since you will be reusing subjects and so they won't be as different from each other as in a true data set). Terry has also indicated that whether the predictors vary with time or not should not affect the power/sample size calculations, so if you have a canned approach (or just simpler approach) for non-varying predictors then you could just use that. On Sun, Jul 15, 2012 at 8:02 AM, Paul Miller pjmiller...@yahoo.com wrote: Hi Greg, Thanks for your response. So far I've just been asked to investigate what the analysis likely would involve. The hope was that there were be some sort of quick and easy canned approach. I don't really think this is the case though. If I'm asked to do the actual analysis itself, I'll start out using the steps you've listed and see where that takes me. Paul --- On *Fri, 7/13/12, Greg Snow 538...@gmail.com* wrote: From: Greg Snow 538...@gmail.com Subject: Re: [R] Power analysis for Cox regression with a time-varying covariate To: Paul Miller pjmiller...@yahoo.com Cc: r-help@r-project.org Received: Friday, July 13, 2012, 3:29 PM 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...@yahoo.comhttp://ca.mc1616.mail.yahoo.com/mc/compose?to=pjmiller...@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@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.
Re: [R] Power analysis for Cox regression with a time-varying covariate
Hi Greg, Thanks for your response. So far I've just been asked to investigate what the analysis likely would involve. The hope was that there were be some sort of quick and easy canned approach. I don't really think this is the case though. If I'm asked to do the actual analysis itself, I'll start out using the steps you've listed and see where that takes me. Paul --- On Fri, 7/13/12, Greg Snow 538...@gmail.com wrote: From: Greg Snow 538...@gmail.com Subject: Re: [R] Power analysis for Cox regression with a time-varying covariate To: Paul Miller pjmiller...@yahoo.com Cc: r-help@r-project.org Received: Friday, July 13, 2012, 3:29 PM 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...@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@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. 538...@gmail.com [[alternative HTML version deleted]] __ 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.
[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 __ 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.
Re: [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...@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@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. 538...@gmail.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.