Skip to contents

This is an initial attempt to enable easy calculation/visualization of study designs from R/gap which benchmarked relevant publications and eventually the app can produce more generic results.

One can run the app with R/gap installation as follows,

Alternatively, one can run the app from source using gap/inst/shinygap. In fact, these are conveniently wrapped up as runshinygap() function.

To set the default parameters, some compromises need to be made, e.g., Kp=[1e-5, 0.4], MAF=[1e-3, 0.8], alpha=[1e-8, 0.05], beta=[0.01, 0.4]. The slider inputs provide upper bounds of parameters.

The interactive Shiny GUI is available, and can be access from a particular port: http://127.0.0.1:6421, say.

Family-based study

This is a call to fbsize().

Population-based study

This is a call to pbsize().

Case-cohort study

This is a call to ccsize() whose power argument indcates power (TRUE) or sample size (FALSE) calculation.

Two-stage case-control design

We implement it in function whose format is

tscc(model, GRR, p1, n1, n2, M, alpha.genome, pi.samples, pi.markers, K)

which requires specification of disease model (multiplicative, additive, dominant, recessive), genotypic relative risk (GRR), the estimated risk allele frequency in cases (p1p_1), total number of cases (n1n_1) total number of controls (n2n_2), total number of markers (MM), the false positive rate at genome level (α𝑔𝑒𝑛𝑜𝑚𝑒\alpha_\mathit{genome}), the proportion of markers to be selected (π𝑚𝑎𝑟𝑘𝑒𝑟𝑠\pi_\mathit{markers}, also used as the false positive rate at stage 1) and the population prevalence (KK).


Appendix: Theory

A. Family-based and population-based designs

This is detailed in the package vignettes gap, https://cran.r-project.org/package=gap, or jss1.

B. Case-cohort design

Our implemention is with respect to two aspects2.

B.1 Power

Φ(Zα+ñ12θp1p2pDq+(1q)pD)\Phi\left(Z_\alpha+\tilde{n}^\frac{1}{2}\theta\sqrt{\frac{p_1p_2p_D}{q+(1-q)p_D}}\right) where α\alpha is the significance level, θ\theta is the log-hazard ratio for two groups, pj,j=1,2p_j, j = 1, 2, are the proportion of the two groups in the population (p1+p2=1p_1 + p_2 = 1), ñ\tilde{n} is the total number of subjects in the subcohort, pDp_D is the proportion of the failures in the full cohort, and qq is the sampling fraction of the subcohort.

B.2 Sample size

ñ=nBpDnB(1pD)\tilde{n}=\frac{nBp_D}{n-B(1-p_D)} where B=Z1α+Zβθ2p1p2pDB=\frac{Z_{1-\alpha}+Z_\beta}{\theta^2p_1p_2p_D} and nn is the whole cohort size.

C. Two-stage case-control design

Tests of allele frequency differences between cases and controls in a two-stage design are described here3. The usual test of proportions can be written as z(p1,p2,n1,n2,πsamples)=p1p2p1(1p1)2n1πsample+p2(1p2)2n2πsamplez(p_1,p_2,n_1,n_2,\pi_{samples})=\frac{p_1-p_2}{\sqrt{\frac{p_1(1-p_1)}{2n_1\pi_{sample}}+\frac{p_2(1-p_2)}{2n_2\pi_{sample}}}} where p1p_1 and p2p_2 are the allele frequencies, n1n_1 and n2n_2 are the sample sizes, πsamples\pi_{samples} is the proportion of samples to be genotyped at stage 1. The test statistics for stage 1, for stage 2 as replication and for stages 1 and 2 in a joint analysis are then z1=z(p̂1,p̂2,n1,n2,πsamples)z_1 = z(\hat p_1,\hat p_2,n_1,n_2,\pi_{samples}), z2=z(p̂1,p̂2,n1,n2,1πsamples)z_2 = z(\hat p_1,\hat p_2,n_1,n_2,1-\pi_{samples}), zj=πsamplesz1+1πsamplesz2z_j = \sqrt{\pi_{samples}}z_1+\sqrt{1-\pi_{samples}}z_2, respectively. Let C1C_1, C2C_2, and CjC_j be the thresholds for these statistics, the false positive rates can be obtained according to P(|z1|>C1)P(|z2|>C2,sign(z1)=sign(z2))P(|z_1|>C_1)P(|z_2|>C_2,sign(z_1)=sign(z_2)) and P(|z1|>C1)P(|zj|>Cj||z1|>C1)P(|z_1|>C_1)P(|z_j|>C_j||z_1|>C_1) for replication-based and joint analyses, respectively.

References

1.
Zhao, J. H. gap: Genetic analysis package. Journal of Statistical Software 23, 1–18 (2007).
2.
Cai, J. & Zeng, D. Sample size/power calculation for case-cohort studies. Biometrics 60, 1015–24 (2004).
3.
Skol, A. D., Scott, L. J., Abecasis, G. R. & Boehnke, M. Joint analysis is more efficient than replication-based analysis for two-stage genome-wide association studies. Nat Genet 38, 209–13 (2006).