powerEpi.default(n, theta, p, psi, rho2, alpha = 0.05)Suppose we want to check if the hazard of $X_1=1$ is equal to the hazard of $X_1=0$ or not. Equivalently, we want to check if the hazard ratio of $X_1=1$ to $X_1=0$ is equal to $1$ or is equal to $\exp(\beta_1)=\theta$. Given the type I error rate $\alpha$ for a two-sided test, the power required to detect a hazard ratio as small as $\exp(\beta_1)=\theta$ is $$power=\Phi\left(-z_{1-\alpha/2}+\sqrt{n[\log(\theta)]^2 p (1-p) \psi (1-\rho^2)}\right),$$ where $\psi$ is the proportion of subjects died of the disease of interest, and $$\rho=corr(X_1, X_2)=(p_1-p_0)\times \sqrt{\frac{q(1-q)}{p(1-p)}},$$ and $p=Pr(X_1=1)$, $q=Pr(X_2=1)$, $p_0=Pr(X_1=1|X_2=0)$, and $p_1=Pr(X_1=1 | X_2=1)$.
Latouche A., Porcher R. and Chevret S. (2004). Sample size formula for proportional hazards modelling of competing risks. Statistics in Medicine. 23:3263-3274.
powerEpi# Example at the end of Section 5.2 of Latouche et al. (2004)
# for a cohort study.
powerEpi.default(n = 139, theta = 2, p = 0.39, psi = 0.505,
rho2 = 0.132^2, alpha = 0.05)Run the code above in your browser using DataLab