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?