Sunday, June 14, 2015

Sample Size and Power Calculation Using SAS Proc Power and twosamplesurvival Statement

For sample size and power calculations, several commercially available software can be used. The commonly used ones are EAST, PASS, and NQuery Advisor. SAS has a procedure (PROC POWER) that can be used for sample size and power calculations for many types of the study designs / study endpoints. One of the statements (twosamplesurvival) in Proc Power is for comparing two survival curves and calculating the sample size/power for time to event variable.

The syntax and descriptions for Twosamplesurvival statement in PROC POWER can be found on SAS website. It can be used to calculate:

  • the total number of events needed (EVENTSTOTAL = .  Option)
  • the total number of subjects needed (NTOTAL = . Option)
  • the number of subjects needed per treatment group (NPERGROUP=. Option)
  • the statistical power (POWER=. Option)

Notice that only one option designated as the result is allowed. If we want to get both the total number of events and the total number of subjects, we would need to run the program two times: one for solving the total number of events and one for solving the total number of subjects.

Here are some of the example applications of using twosamplesurvival statement.


In a SUGI paper "Proc Power in SAS 9.1" by Bauer, Lavery, and Ford, an example was provided to calculate the sample size for log-rank test with 2:1 randomization ratio and with drop out.

The example assumes 30% of placebo patients are sustained responders (exponential hazard =0.3567) compared to 45 or 50% for the treatment group (exp. hazard = 0.5978 or 0.6931). Twice as many patients are on treatment as placebo, and all patients are enrolled at the beginning of the study with a 30% drop-out rate.

Prior to the sample size calculation, the event rates were converted to hazards. Exponential hazard in Placebo group = - ln(1 - event rate) = -ln(1-0.3) = 0.3567.  Similarly, Exponential hazards corresponding to 45% or 50% event rate were 0.5978 and 0.6931.

The dropout rate were also converted to group loss hazards in the same way. Therefore, the 30% dropout rate was corresponding to the group loss hazard of -ln(1-dropout rate)=-ln(1-0.3)=0.3567.

Groupweights statement was used to indicate the 2:1 randomization ratio. 

proc power;
       twosamplesurvival test=logrank
       gexphs= 0.3567 | 0.5978 .6931
       grouplossexphazards=(0.3567 0.3567)
       accrualtime = 1
       followuptime = 1
       groupweights = (1 2)
       power = .


Dr Hudgens from UNC had a nice posting about the power and sample size calculations for log-rank test. He gave an example as following:

Clinical trial to assess new treatment for patients with chronic active hepatitis. Under standard treatment, 41% of patients survive beyond 5 years. Expect new treatment to increase survival beyond 5 years to 60%.

In order to calculate the sample size, we will need to calculate some parameters.
Event rate for standard treatment (Ec) = 1-0.41 = 0.59
Event rate for new treatment (Et) = 1-0.60 = 0.4
Since event rate E = 1 - exp(-t*HAZARD), we have HAZARD = -ln((1-E)/t   
The Hazard for standard treatment is HAZARDc=-ln(1-Ec)/t = -ln(1-0.59)/t = -ln(0.41)/t
The Hazard for new treatment is HAZARDt = -ln(1-Et)/t = -ln(1-0.40)/t = -ln(0.60)/t
The hazard ratio  = HAZARDt/HAZARDc = ln((0.6)/ln(0.41)=0.5729
T=5, the hazard for standard treatment is HAZARDc = -ln(0.41)/5 = 0.178

After these calculation, the following SAS codes can be used to calculate the sample size:

proc power;
    twosamplesurvival test=logrank
    hazardratio = 0.57
    followuptime = 5
    totalTIME = 5
    power = 0.90
    ntotal = . ;

EXAMPLE #3: Sample Size Calculation with piecewise linear survival curve

SAS has a GUI desktop application PSS (the Power and Sample Size Application) that provides easy access to power analysis and sample size determination techniques. Anything implemented in PSS desktop application can also be realized using Proc Power. Here is a link to an example from using PSS desktop application. The calculation can be realized using Proc Power Twosamplesurvival.

Suppose you want to compare survival rates for an existing cancer treatment and a new treatment. You intend to use a log-rank test to compare the overall survival curves for the two treatments. You want to determine a sample size to achieve a power of 0.8 for a two-sided test using a balanced design, with a significance level of 0.05.

The survival curve of patients for the existing treatment is known to be approximately exponential with a median survival time of five years. You think that the proposed treatment will yield a survival curve described by the times and probabilities listed in Table 69.9. Patients are to be accrued uniformly over two years and followed for three years.

Table 69.9 Survival Probabilities for Proposed Treatment

The descriptions for using PSS desktop application for this example can be found on SAS website. The following program will do exactly the same.

proc power;
      twosamplesurvival test=logrank
       curve("Existing Treatment") = 5 : 0.5
      curve("Proposed Treatment") = 1 : 0.95 2 : 0.90 3:0.75  4:0.70 5:0.60
      groupsurvival = "Existing Treatment" | "Proposed Treatment"
      accrualtime = 2
      power = 0.80
      npergroup = . ;

twosamplesurvival statement embedded in PROC SEQDESIGN can be used to estimate the sample size for group sequential design with interim analyses.

In the following SAS program to calculate the sample size, the survival probability at 12 months are for standard and proposed groups are specified and the statement of grouplossexphazards is used to account for the dropout rate.

proc power;
      twosamplesurvival test=logrank
      curve(“Standard”) = 12 : 0.8781
      curve(“Proposed”) = 12 : 0.9012
      groupsurvival = “Standard” | “Proposed”
      accrualtime = 18
      Totaltime = 24
      GROUPLOSSEXPHAZARDS = (0.0012 0.0012)
      power = 0.85
      ntotal = . ;

Sunday, June 07, 2015

Some Explanations about Survival Analysis or Time to Event Analysis

The concept of Survival analysis came from the old days for cancer study where the measurement is the length of the survival or time to death. The concept of survival analysis has since been generalized to ‘time to event’ analysis. ‘Time to death’ is just one type of time to event variables. There are a lot of events that can be analyzed in the same way. For time to event measures, the event can be positive and negative. For example, in a clinical trial for recurrent herpes labialis (or cold sores), the event (healing of the primary lesion complex) is positive. The time to event is measured as time to healing of the primary lesion complex. Perhaps, more clinical trials have the negative event (event is bad). In oncology studies, we measure survival (or time to death). In COPD studies, we may measure time to exacerbation. In a PAH study, we may measure time to clinical worsening.

In short, in Time to Event analysis, the analysis relates not just to whether an event occurs but also when.
The planning (for example sample size estimation) and analysis of the time to event study, several important concepts and their relationship are important. These concepts and their relationships are explained below:

Time to Event is just the measure from the start of an intervention to the time when an event occurs. The start of an intervention could be the randomization, start of the treatment, date of surgery,…

Event Rate is the proportion of subjects or patients in a group in whom an event is observed.  Event rate is usually measured for a period of the time from t to t + Dt. For example, if the Dt = 12 months, the event rate will be for one year. Event rate is also given as the event rate for the entire study period.

Hazard Rate is the probability of an event occurring given that it hasn’t occurred up to the current point in time. Hazard rate is the instantaneous risk of a patient experiencing a particular event at each specified time. The instantaneous rate with which an event occurs at a single point in time. It is the probability that the event occurs between time t and time t+delta given that it has not yet occurred by time t, divided by delta, as delta becomes vanishingly small. Note that rates, unlike probabilities, can exceed 1.0 because they are quotients.

Hazard Ratio is a measure of effect produced by a survival analysis. This represents the increased risk with which one group is likely to experience the outcome of interest.  For example, if the hazard ratio for death for a treatment is 0.5, then we can say that treated patients are likely to die at half the rate of untreated patients.

Hazard ratio is calculated as the ratio of hazard rates at a single time t, for two groups of subjects (treatment versus control group). Hazard ratios are in the interval [0, infinity), and they are frequently good ways to summarize the relative effects of two treatments at a specific time t. Like odds ratios, hazard ratios can apply to any level of outcome probability for the reference group. Note that a hazard ratio is distinct from a risk ratio, the latter being the ratio of two simple probabilities and not the ratio of two rates.

The Median Event Time is calculated as the smallest even time for which the event function is less or equal to 0.5.

When the event is death, the median event time is called the median survival time. The median survival time is calculated as the smallest survival time for which the survivor function is less than or equal to 0.5. In oncology study, median survival time the time from either diagnosis or treatment at which half of the patients with a given disease are found to be, or expected to be, still alive. In a clinical trial, median survival time is one way to measure the effectiveness of a treatment to see how well a new treatment works. Median survival time may be called median overall survival or simply median survival.  
Censoring is a form of missing data problem which is common in survival analysis and time to event analysis. In clinical trials, we usually have to deal with the right censoring. In the situation of the right censoring, the event did not occur when subjects are lost to follow-up or when the study ends. A patient might be known not to have had the event only up to a particular point in time, so ‘time to event’ or ‘survival time’ is censored at this point.

Lost to Follow-up refers to patients who at one point in time were actively participating in a clinical trial, but have become lost (either by error in a computer tracking system or by being unreachable) at the point of follow-up in the trial. These patients can become lost for many reasons. Without properly informing the investigator associated with the clinical trial, they may have opted to withdraw from the clinical trial, moved away from the particular study site during the clinical trial, or become ill and unable to communicate or are deceased.

Attrition: The loss of participants during the course of a study. Participants that are lost during the study are often call dropouts.

Accrual time or accrual period is recruitment period during which subjects are being enrolled (recruited) into a study.
Follow-up time or follow-up period is the period after the last subject entered the study until the end of the study. The follow-up defines the phase of a study during which subjects are under observation and no new subjects enter the study.

If T is the total duration of a study, and R is the accrual period of the study, then follow-up period f is equal to T – R.
Event Rate =  1 -  Non Event Rate
Mortality Rate =  1 - Survival Rate

Given the MET (median event time), we can calculate the hazard rate and the event rate, and hazard ratio.

If METc is the Median event time for control group and METt is the Median event time for treatment group, HAZARDc and HAZARDt are Hazard rates for control group and treatment groups, we will have:
        HAZARDc = log(2)/METc       
        HAZARDt = log(2)/METt
        METc  = log(2)/HAZARDc       
        METt = log(2)/HAZARDt

    Event rate at month 12 for control group is
      Ec = 1 - exp(-12*HAZARDc) 

    Event rate at month 12 for treatment group is  
      Et = 1 - exp(-12*HAZARDt);   

    HAZARD rate can be calculated from Event rate (for example event rate at month 12)
      HAZARDc = -ln(1-Ec) / t   (for example t=12)
      HAZARDt  = -ln(1-Et) / t   (for example t=12)  
The hazard ratio is:

If the given parameter is event rate over the entire course of the study (for example, 5 years), the event rate for one year can be calculated using the following formula:

        1 - (1 - event rate)^(1/t)

        where t=5

 If the given parameter is event rate over one year period, the event rate for five year study period can be calculated using the formula below:

       1 - exp(t*ln(1 - annual event rate))

        where t=5

The formula above can also be used to convert the loss follow up rate from the entire treatment period to one year or vice versa.