**Sample Size Software for the Supremum Log-Rank **(for a translation into Portuguese, please click here; for a translation into Romanian, please click here; for translation into Russian, please click here; for translation into Ukrainian, please click here)

The algorithm used for computing sample size for the supremum log-rank is described in detail in “A sample size formula for the supremum log-rank statistic” by Kevin Hasegawa Eng and Michael R. Kosorok, published in *Biometrics* 61:86-91, 2005. We recommend reading this thoroughly before using the software described below. As part of this package, the function surv.Rtest for computing the supremum weighted log-rank and its p-value is included. The family of weights used are the G(rho,gamma) class (Harrington and Fleming, 1982 Biometrika). An optional argument enables computation of the usual weighted log-rank.

To incorporate the software into R, insert the code obtained by clicking here into R. To do this in a unix environment, place this code in a file (named, for example, “renyi.r”) in a subdirectory. In that subdirectory, begin Rand type the following command: source(“renyi.r”). This procedure will create the functions sup.r, sup.inverse, cnorm, sup.g, sup.G, surv.Rtest and KM.left.

The function sup.r computes the quantity *R* described in the above technical report. This quantity times the sample size based on the regular log-rank statistic will give the sample size required for the supremum log-rank. The arguments required by sup.r are alpha (the two-sided type I error) and beta (the type II error). The function sup.r calls the following functions:

- The function sup.inverse computes the critical values for the supremum in absolute value of Brownian motion. The only argument required for this function is the type I error alpha.
- The function cnorm computes the area to the right of
*z*under a standard normal density. It is more accurate than the R function pnorm. The only required argument is*z*. - The function sup.G computes the value of the function
*G(x)*defined in the above technical report. The only required argument is*x*. - The function sup.g computes the derivative of
*G(x)*. The only required argument is*x*.

The function surv.Rtest computes the supremum weighted log-rank test and its p-value, along with the non-supremum weighted log-rank test if requested. Tied values are allowed, and the variance is calculated correctly for ties. The p-values have not been adjusted for ties, but the computed p-values will be conservative in the presence of ties (and asymptotically exact when no ties are present). The required arguments are time (the event times), delta (the censoring indicators) and group (treatment indicators which must take on the values 1 or 2 only). No missing values are allowed. Optional arguments are rho and gamma (both with default value 0) which are the powers of the left-continuous pooled Kaplan-Meier estimator *S(**t-)* and *1-S(t-)*, respectively. Another optional argument is the logical logrank (with default value F) which indicates whether the usual weighted logrank is also to be calculated (with the same weight function used in the supremum version). The final optional argument is the error permitted for the supremum p-value (with default 1.0e-8). The function surv.Rtestcalls the following function:

- The function KM.left is called by surv.Rtest to calculate the weights if either rho or gamma (optional arguments for surv.Rtest) are non-zero. The required arguments are time and delta.