# Sample size / power calculation for logrank survival test

I have really little idea of survival analysis. I am aware that logrank is a special case of Cox' proportional hazards model, and that tons of R packages and scripts address the problem of power / size calculations. However, I didn't manage to make head or tails of all that.

The problem is simple: we have two groups of animals, treated and controls. The treated animals die, and we would like to be able to detect effect such that instead of 20%, 80% of animals will die in the treated group, with power 0.8 and alpha=0.05. Group sizes are equal and no other parameters are given.

What is the necessary group size?

I have found many answers. It seems that it is easy to calculate the number of deaths required from the basic equation:

$n_d = \frac{4(z_{1-\alpha/2}+z_{1-\beta})^2}{\theta^2}$

And $\theta = \log(\frac{\log(0.8)}{\log(0.2)}) = -1.98$

so $n_d = 8$ (EDIT: I had an error in my calculations before; hence I was calculating for power 0.9 and not 0.8).

Also, I'm quite at loss as to what to do further, and furthermore, I have no idea where the above formula is derived from.

EDIT

I used the ssizeCT.default function from the powerSurvEpi R package. Based on the explanation in the package manual, this calculates (in my simple case) the required sample size in a group as follows:

$n = \frac{m}{p_E + p_C}$

where $p_E$ and $p_C$ are, respectively, probabilities of failure in the E(xpermiental) and C(ontrol) groups. I assume that in my case I should use 0.8 and 0.2, respectively, so $n=m$.

$m$ is calculated as

$m=\big(\frac{RR+1}{RR-1}\big)^2(z_{1-\alpha/2}+z_{1-\beta})^2$

Where $RR=exp(\theta)=0.139$; thus $m=18.3$. This seems reasonable (based on previous experience). Do you think these calculations are correct? Can you help me understanding what actually I am doing?

• check out R package "LogrankPower" Oct 12, 2019 at 16:57

According to the problem you described, you want to set the death rate =20% for the reference or control group, effect.size=-3 (this will help set the death rate in the treated group to 80%) in LRPower() function:

LRPower(100, reference.group.incidence=0.2, effect.size = -3, simulation.n = 5000)

[1] 0.9948

LRPower(40, reference.group.incidence=0.2, effect.size = -3, simulation.n = 5000)

[1] 0.797

Thus, you need 20 control and 20 treated animals to distinguish 80% death rate in treated from 20% death rate in control group with 79.7% power while holding significance level at 0.05. In LRPower() function, the default type I error is 0.05, and the default group.sample.size.ratio=1.

For the reason why you need to set effect.size = -3, please check out the method file here: https://github.com/RongUTSW/Methods/blob/master/LRPowerSimulation.pdf