ssizeEpiInt(X1, X2, failureFlag, power, theta, alpha = 0.05)nPilot by 1 vector, where nPilot is the number of subjects
in the pilot data set. This vector records the values of the covariate of
interest for the nPilot subjects in the pilot study. X1 shnPilot by 1 vector, where nPilot is the number of subjects
in the pilot study. This vector records the values of the second covariate
for the nPilot subjects in the pilot study.
X2 shouldnPilot by 1 vector of indicators indicating if a subject is
failure (failureFlag=1) or alive (failureFlag=0).G when an interaction of the
same magnitude is to be detected.Suppose we want to check if the hazard ratio of the interaction effect $X_1 X_2=1$ to $X_1 X_2=0$ is equal to $1$ or is equal to $\exp(\gamma)=\theta$. Given the type I error rate $\alpha$ for a two-sided test, the total number of subjects required to achieve the desired power $1-\beta$ is: $$n=\frac{\left(z_{1-\alpha/2}+z_{1-\beta}\right)^2 G}{ [\log(\theta)]^2 \psi (1-p) p (1-\rho^2) },$$ 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)$, and $$G=\frac{[(1-q)(1-p_0)p_0+q(1-p_1)p_1]^2}{(1-q)q (1-p_0)p_0 (1-p_1) p_1},$$ and $p0=Pr(X_1=1 | X_2=0)=myc/(mya+myc)$, $p1=Pr(X_1=1 | X_2=1)=myd/(myb+myd)$, $p=Pr(X_1=1)=(myc+myd)/n$, $q=Pr(X_2=1)=(myb+myd)/n$, $n=mya+myb+myc+myd$.
$p_{00}=Pr(X_1=0,\mbox{and}, X_2=0)$, $p_{01}=Pr(X_1=0,\mbox{and}, X_2=1)$, $p_{10}=Pr(X_1=1,\mbox{and}, X_2=0)$, $p_{11}=Pr(X_1=1,\mbox{and}, X_2=1)$.
$p_{00}$, $p_{01}$, $p_{10}$, $p_{11}$, and $\psi$ will be estimated from the pilot data.
ssizeEpiInt.default0, ssizeEpiInt2# generate a toy pilot data set
X1 <- c(rep(1, 39), rep(0, 61))
set.seed(123456)
X2 <- sample(c(0, 1), 100, replace = TRUE)
failureFlag <- sample(c(0, 1), 100, prob = c(0.25, 0.75), replace = TRUE)
ssizeEpiInt(X1, X2, failureFlag, power = 0.88, theta = 3, alpha = 0.05)Run the code above in your browser using DataLab