ssizeCT(formula, dat, power, k, RR, alpha = 0.05)Surv(time, status) ~ x, where
time is a vector of survival/censoring time, status is a vector of
censoring indicator, x is the group indicator,
which is a factor objeC for control grouRR.nTimes+1 rows, where nTimes is the number of
observed time points for the control group in the data set. The 9 columns are
(1) time - observed time point for the control group;
(2) lambda;
(3) RRlambda;
(4) delta;
(5) A;
(6) B;
(7) C;
(8) D;
(9) E.
Please refer to the Details section for the definitions of elements
of these quantities. See also Table 14.24 on page 809 of Rosner (2006).nTimes+1 rows, where nTimes is the number of
observed time points for control group in the data set. The 5 columns are
(1) time - observed time point for the control group;
(2) nEvent.C - number of events in the control group at each time point;
(3) nCensored.C - number of censorings in the control group at each time point;
(4) nSurvive.C - number of alived in the control group at each time point;
(5) nRisk.C - number of participants at risk in the control group at each time point.
Please refer to Table 14.12 on page 787 of Rosner (2006).The movitation of this function is that some times we do not have information about $m$ or $p_E$ and $p_C$ available, but we have a pilot data set that can be used to estimate $p_E$ and $p_C$ hence $m$, where $m=n_E p_E + n_C p_C$ is the expected total number of events over both groups, $n_E$ and $n_C$ are numbers of participants in group E (experimental group) and group C (control group), respectively. $p_E$ is the probability of failure in group E (experimental group) over the maximum time period of the study (t years). $p_C$ is the probability of failure in group C (control group) over the maximum time period of the study (t years).
Suppose we want to compare the survival curves between an experimental group ($E$) and a control group ($C$) in a clinical trial with a maximum follow-up of $t$ years. The Cox proportional hazards regression model is assumed to have the form: $$h(t|X_1)=h_0(t)\exp(\beta_1 X_1).$$ Let $n_E$ be the number of participants in the $E$ group and $n_C$ be the number of participants in the $C$ group. We wish to test the hypothesis $H0: RR=1$ versus $H1: RR$ not equal to 1, where $RR=\exp(\beta_1)=$underlying hazard ratio for the $E$ group versus the $C$ group. Let $RR$ be the postulated hazard ratio, $\alpha$ be the significance level. Assume that the test is a two-sided test. If the ratio of participants in group E compared to group C $= n_E/n_C=k$, then the number of participants needed in each group to achieve a power of $1-\beta$ is $$n_E=\frac{m k}{k p_E + p_C}, n_C=\frac{m}{k p_E + p_C}$$ where $$m=\frac{1}{k}\left(\frac{k RR + 1}{RR - 1}\right)^2\left( z_{1-\alpha/2}+z_{1-\beta} \right)^2,$$ and $z_{1-\alpha/2}$ is the $100 (1-\alpha/2)$ percentile of the standard normal distribution $N(0, 1)$.
$p_C$ and $p_E$ can be calculated from the following formulaes:
$$p_C=\sum_{i=1}^{t}D_i, p_E=\sum_{i=1}^{t}E_i,$$
where $D_i=\lambda_i A_i C_i$, $E_i=RR\lambda_i B_i C_i$,
$A_i=\prod_{j=0}^{i-1}(1-\lambda_j)$, $B_i=\prod_{j=0}^{i-1}(1-RR\lambda_j)$,
$C_i=\prod_{j=0}^{i-1}(1-\delta_j)$. And
$\lambda_i$ is the probability of failure at time i among participants in the
control group, given that a participant has survived to time $i-1$ and is not censored at time $i-1$,
i.e., the approximate hazard time $i$ in the control group, $i=1,...,t$;
$RRlambda_i$ is the probability of failure at time i among participants in the
experimental group, given that a participant has survived to time $i-1$ and is not censored at time $i-1$,
i.e., the approximate hazard time $i$ in the experimental group, $i=1,...,t$;
$delta$ is the prbability that a participant is censored at time $i$ given that he was
followed up to time $i$ and has not failed, $i=0, 1, ..., t$, which is assumed the same in each group.
Rosner B. (2006). Fundamentals of Biostatistics. (6-th edition). Thomson Brooks/Cole.
ssizeCT.default# Example 14.42 in Rosner B. Fundamentals of Biostatistics.
# (6-th edition). (2006) page 809
library(survival)
data(Oph)
res <- ssizeCT(formula = Surv(times, status) ~ group, dat = Oph,
power = 0.8, k = 1, RR = 0.7, alpha = 0.05)
# Table 14.24 on page 809 of Rosner (2006)
print(round(res$mat.lambda, 4))
# Table 14.12 on page 787 of Rosner (2006)
print(round(res$mat.event, 4))
# the sample size
print(res$ssize)Run the code above in your browser using DataLab