| Title: | Power and Sample Size Analysis for Genetic Studies with Heterogeneity and Misclassification |
|---|---|
| Description: | Provides prospective power and minimum sample size necessary (MSSN) calculations for genetic and genomic association study design. Supported designs include case-control studies, transmission disequilibrium tests with affected-child trios, and single- and multivariate quantitative-trait studies. The package emphasizes selected departures from idealized assumptions, including locus heterogeneity and supported forms of genotype and phenotype misclassification. These factors can materially affect power and sample-size requirements but can be difficult to incorporate analytically. Published statistical-genetics methods are implemented in a reproducible, primarily parameter- and model-based framework with static visualizations and an optional Shiny dashboard for interactive exploration. The software supports prospective study planning; it does not perform downstream association testing. |
| Authors: | Akil Anthony [aut, cre] (ORCID: <https://orcid.org/0009-0008-8813-8560>), Derek Gordon [aut] |
| Maintainer: | Akil Anthony <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 0.99.0 |
| Built: | 2026-10-17 10:43:50 UTC |
| Source: | https://github.com/BiocStaging/paweh |
Convenience functions for genotype-only case-control chi-square calculations
under conditional model-based genotype frequencies and genotype
misclassification. These functions are narrower than
cc_mssn and
cc_power: they compute only the genotype
chi-square test for one specific misclassification model.
cc_chisq_mssn_genotype_misclassification_1p( power, alpha, prev, pd, R2, MOI = c("M", "D", "Rec"), k = 1, e = 0, verbose = TRUE ) cc_chisq_power_genotype_misclassification_1p( N_case, alpha, prev, pd, R2, MOI = c("M", "D", "Rec"), k = 1, e = 0, verbose = TRUE ) cc_chisq_mssn_genotype_misclassification_2p( power, alpha, prev, pd, R2, MOI = c("M", "D", "Rec"), k = 1, e1 = 0, e2 = 0, verbose = TRUE ) cc_chisq_power_genotype_misclassification_2p( N_case, alpha, prev, pd, R2, MOI = c("M", "D", "Rec"), k = 1, e1 = 0, e2 = 0, verbose = TRUE ) cc_chisq_mssn_genotype_misclassification_3p( power, alpha, prev, pd, R2, MOI = c("M", "D", "Rec"), k = 1, e01 = 0, e02 = 0, e03 = 0, verbose = TRUE ) cc_chisq_power_genotype_misclassification_3p( N_case, alpha, prev, pd, R2, MOI = c("M", "D", "Rec"), k = 1, e01 = 0, e02 = 0, e03 = 0, verbose = TRUE ) cc_chisq_mssn_genotype_misclassification_differential_3p( power, alpha, prev, pd, R2, MOI = c("M", "D", "Rec"), k = 1, case_e01 = 0, case_e02 = 0, case_e03 = 0, ctrl_e01 = 0, ctrl_e02 = 0, ctrl_e03 = 0, verbose = TRUE ) cc_chisq_power_genotype_misclassification_differential_3p( N_case, alpha, prev, pd, R2, MOI = c("M", "D", "Rec"), k = 1, case_e01 = 0, case_e02 = 0, case_e03 = 0, ctrl_e01 = 0, ctrl_e02 = 0, ctrl_e03 = 0, verbose = TRUE )cc_chisq_mssn_genotype_misclassification_1p( power, alpha, prev, pd, R2, MOI = c("M", "D", "Rec"), k = 1, e = 0, verbose = TRUE ) cc_chisq_power_genotype_misclassification_1p( N_case, alpha, prev, pd, R2, MOI = c("M", "D", "Rec"), k = 1, e = 0, verbose = TRUE ) cc_chisq_mssn_genotype_misclassification_2p( power, alpha, prev, pd, R2, MOI = c("M", "D", "Rec"), k = 1, e1 = 0, e2 = 0, verbose = TRUE ) cc_chisq_power_genotype_misclassification_2p( N_case, alpha, prev, pd, R2, MOI = c("M", "D", "Rec"), k = 1, e1 = 0, e2 = 0, verbose = TRUE ) cc_chisq_mssn_genotype_misclassification_3p( power, alpha, prev, pd, R2, MOI = c("M", "D", "Rec"), k = 1, e01 = 0, e02 = 0, e03 = 0, verbose = TRUE ) cc_chisq_power_genotype_misclassification_3p( N_case, alpha, prev, pd, R2, MOI = c("M", "D", "Rec"), k = 1, e01 = 0, e02 = 0, e03 = 0, verbose = TRUE ) cc_chisq_mssn_genotype_misclassification_differential_3p( power, alpha, prev, pd, R2, MOI = c("M", "D", "Rec"), k = 1, case_e01 = 0, case_e02 = 0, case_e03 = 0, ctrl_e01 = 0, ctrl_e02 = 0, ctrl_e03 = 0, verbose = TRUE ) cc_chisq_power_genotype_misclassification_differential_3p( N_case, alpha, prev, pd, R2, MOI = c("M", "D", "Rec"), k = 1, case_e01 = 0, case_e02 = 0, case_e03 = 0, ctrl_e01 = 0, ctrl_e02 = 0, ctrl_e03 = 0, verbose = TRUE )
power |
Numeric in |
alpha |
Numeric in |
prev |
Numeric in |
pd |
Numeric in |
R2 |
Numeric |
MOI |
Character. Mode of inheritance: |
k |
Numeric |
e |
Numeric in |
verbose |
Logical. If |
N_case |
Numeric |
e1, e2
|
Numeric. Two-parameter genotype misclassification rates. |
e01, e02, e03
|
Numeric. Three-parameter non-differential genotype misclassification rates. |
case_e01, case_e02, case_e03
|
Numeric. Case-specific three-parameter genotype misclassification rates for differential misclassification. |
ctrl_e01, ctrl_e02, ctrl_e03
|
Numeric. Control-specific three-parameter genotype misclassification rates for differential misclassification. |
These are specialized convenience functions retained for users who want a focused genotype-only calculation. The all-in-one case-control functions are recommended when combining model-free inputs, locus heterogeneity, trend tests, or multiple modifier choices in one call.
Conditional genotype probabilities are constructed from prevalence, allele frequency, and relative risks using Chapter 1, Section 1.4.2 and Eqs. 1.6–1.7 (p. 13) of Gordon, Finch, and Kim (2020). The genotype test uses the two-degree-of-freedom NCP in Eq. 1.22 (p. 26). The error matrices are the one-, two-, and three-parameter families in Eqs. 2.5, 2.6, and 2.7 (pp. 57–58). Douglas et al. (2002) and Sobel et al. (2002) support the corresponding error-model families; Gordon et al. (2002) supports their use in case-control power and sample-size calculations.
For the 1p functions, package e is the probability in each adjacent
off-diagonal cell, and the diagonal is . Textbook Eq. 2.5 instead
writes each off-diagonal as and the diagonal as
; therefore .
Differential 3p functions use separate Eq. 2.7-family matrices for cases and controls, as discussed in Chapter 2, Section 2.5.2 (pp. 61–69). Their power is nominal asymptotic power, and their MSSN is nominal MSSN, evaluated with the usual chi-square critical value. Different case and control error mechanisms can distort the null distribution and inflate type I error. These functions do not independently recalibrate the null distribution for arbitrary differential genotyping error.
The returned objects keep internal effect-size components such as S
and, for differential misclassification, per-genotype components, for
validation and debugging.
A list with class matching the function name. MSSN functions include
target non-centrality parameter, case/control sample sizes, model parameters,
penetrances, misclassification matrices, internal S values, and true
and observed genotype frequencies. Power functions include case/control
sample sizes, non-centrality parameter, power, model parameters,
penetrances, misclassification matrices, internal S values, and true
and observed genotype frequencies.
Gordon, D., Finch, S. J., & Kim, W. (2020). Heterogeneity in Statistical Genetics: How to Assess, Address, and Account for Mixtures in Association Studies. Springer. doi:10.1007/978-3-030-61121-7.
Gordon, D., Finch, S. J., Nothnagel, M., & Ott, J. (2002). Power and sample size calculations for case-control genetic association tests when errors are present: application to single nucleotide polymorphisms. Human Heredity, 54(1), 22–33. doi:10.1159/000066696.
Douglas, J. A., Skol, A. D., & Boehnke, M. (2002). Probability of detection of genotyping errors and mutations as inheritance inconsistencies in nuclear-family data. American Journal of Human Genetics, 70(2), 487–495. doi:10.1086/338919.
Sobel, E., Papp, J. C., & Lange, K. (2002). Detection and integration of genotyping errors in statistical genetics. American Journal of Human Genetics, 70(2), 496–508. doi:10.1086/338920.
Ahn, K., Gordon, D., & Finch, S. J. (2009). Increase of rejection rate in case-control studies with the differential genotyping error rates. Statistical Applications in Genetics and Molecular Biology, 8(1), Article 25. doi:10.2202/1544-6115.1429.
cc_power, cc_mssn,
case_control_locus_heterogeneity, and
case_control_phenotype_misclassification.
cc_chisq_mssn_genotype_misclassification_1p( power = 0.8, alpha = 0.05, prev = 0.1, pd = 0.3, R2 = 1.8, MOI = "D", e = 0.02, verbose = FALSE ) cc_chisq_power_genotype_misclassification_1p( N_case = 500, alpha = 0.05, prev = 0.1, pd = 0.3, R2 = 1.8, MOI = "D", e = 0.02, verbose = FALSE ) cc_chisq_mssn_genotype_misclassification_2p( power = 0.8, alpha = 0.05, prev = 0.1, pd = 0.3, R2 = 1.8, MOI = "D", e1 = 0.02, e2 = 0.01, verbose = FALSE ) cc_chisq_power_genotype_misclassification_2p( N_case = 500, alpha = 0.05, prev = 0.1, pd = 0.3, R2 = 1.8, MOI = "D", e1 = 0.02, e2 = 0.01, verbose = FALSE ) cc_chisq_mssn_genotype_misclassification_3p( power = 0.8, alpha = 0.05, prev = 0.1, pd = 0.3, R2 = 1.8, MOI = "D", e01 = 0.02, e02 = 0.01, e03 = 0.005, verbose = FALSE ) cc_chisq_power_genotype_misclassification_3p( N_case = 500, alpha = 0.05, prev = 0.1, pd = 0.3, R2 = 1.8, MOI = "D", e01 = 0.02, e02 = 0.01, e03 = 0.005, verbose = FALSE ) cc_chisq_mssn_genotype_misclassification_differential_3p( power = 0.8, alpha = 0.05, prev = 0.1, pd = 0.3, R2 = 1.8, MOI = "D", case_e01 = 0.02, case_e02 = 0.01, case_e03 = 0.005, ctrl_e01 = 0.01, ctrl_e02 = 0.005, ctrl_e03 = 0.002, verbose = FALSE ) cc_chisq_power_genotype_misclassification_differential_3p( N_case = 500, alpha = 0.05, prev = 0.1, pd = 0.3, R2 = 1.8, MOI = "D", case_e01 = 0.02, case_e02 = 0.01, case_e03 = 0.005, ctrl_e01 = 0.01, ctrl_e02 = 0.005, ctrl_e03 = 0.002, verbose = FALSE )cc_chisq_mssn_genotype_misclassification_1p( power = 0.8, alpha = 0.05, prev = 0.1, pd = 0.3, R2 = 1.8, MOI = "D", e = 0.02, verbose = FALSE ) cc_chisq_power_genotype_misclassification_1p( N_case = 500, alpha = 0.05, prev = 0.1, pd = 0.3, R2 = 1.8, MOI = "D", e = 0.02, verbose = FALSE ) cc_chisq_mssn_genotype_misclassification_2p( power = 0.8, alpha = 0.05, prev = 0.1, pd = 0.3, R2 = 1.8, MOI = "D", e1 = 0.02, e2 = 0.01, verbose = FALSE ) cc_chisq_power_genotype_misclassification_2p( N_case = 500, alpha = 0.05, prev = 0.1, pd = 0.3, R2 = 1.8, MOI = "D", e1 = 0.02, e2 = 0.01, verbose = FALSE ) cc_chisq_mssn_genotype_misclassification_3p( power = 0.8, alpha = 0.05, prev = 0.1, pd = 0.3, R2 = 1.8, MOI = "D", e01 = 0.02, e02 = 0.01, e03 = 0.005, verbose = FALSE ) cc_chisq_power_genotype_misclassification_3p( N_case = 500, alpha = 0.05, prev = 0.1, pd = 0.3, R2 = 1.8, MOI = "D", e01 = 0.02, e02 = 0.01, e03 = 0.005, verbose = FALSE ) cc_chisq_mssn_genotype_misclassification_differential_3p( power = 0.8, alpha = 0.05, prev = 0.1, pd = 0.3, R2 = 1.8, MOI = "D", case_e01 = 0.02, case_e02 = 0.01, case_e03 = 0.005, ctrl_e01 = 0.01, ctrl_e02 = 0.005, ctrl_e03 = 0.002, verbose = FALSE ) cc_chisq_power_genotype_misclassification_differential_3p( N_case = 500, alpha = 0.05, prev = 0.1, pd = 0.3, R2 = 1.8, MOI = "D", case_e01 = 0.02, case_e02 = 0.01, case_e03 = 0.005, ctrl_e01 = 0.01, ctrl_e02 = 0.005, ctrl_e03 = 0.002, verbose = FALSE )
Convenience functions for case-control association calculations under locus heterogeneity. These focused functions compute genotype chi-square or genotype trend calculations one test at a time. The all-in-one case-control functions remain the recommended interface when multiple tests or modifiers are needed in one call.
cc_chisq_mssn_locus_heterogeneity( power, alpha, g_case_assoc, g_ctrl, pi, k = 1, verbose = TRUE ) cc_chisq_power_locus_heterogeneity( N_case, alpha, g_case_assoc, g_ctrl, pi, k = 1, verbose = TRUE ) cc_trend_mssn_locus_heterogeneity( power, alpha, g_case_assoc, g_ctrl, pi, k = 1, w = c(0, 1, 2), verbose = TRUE ) cc_trend_power_locus_heterogeneity( N_case, alpha, g_case_assoc, g_ctrl, pi, k = 1, w = c(0, 1, 2), verbose = TRUE )cc_chisq_mssn_locus_heterogeneity( power, alpha, g_case_assoc, g_ctrl, pi, k = 1, verbose = TRUE ) cc_chisq_power_locus_heterogeneity( N_case, alpha, g_case_assoc, g_ctrl, pi, k = 1, verbose = TRUE ) cc_trend_mssn_locus_heterogeneity( power, alpha, g_case_assoc, g_ctrl, pi, k = 1, w = c(0, 1, 2), verbose = TRUE ) cc_trend_power_locus_heterogeneity( N_case, alpha, g_case_assoc, g_ctrl, pi, k = 1, w = c(0, 1, 2), verbose = TRUE )
power |
Numeric in |
alpha |
Numeric in |
g_case_assoc |
Numeric vector of length 3. Case genotype frequencies
under the associated-locus model, ordered as |
g_ctrl |
Numeric vector of length 3. Control genotype frequencies,
ordered as |
pi |
Numeric in |
k |
Numeric |
verbose |
Logical. If |
N_case |
Numeric |
w |
Numeric vector of length 3. Trend-test genotype scores. The three weights cannot all be equal. |
The associated case distribution is mixed with the control distribution as
, following textbook Eq. 2.16
(p. 88). Thus pi is the homogeneous/associated fraction and
is the heterogeneous fraction. The adjusted probabilities are
then passed to either the genotype chi-square NCP in Eq. 1.22 (p. 26) or the
trend-test NCP in Eq. 1.24 (p. 27). The trend construction under locus
heterogeneity is given more specifically by Eqs. 5.29a–b (pp. 287–288).
A list with class matching the function name. MSSN functions include
target non-centrality parameter, sample sizes, internal S values, and
adjusted frequencies. Power functions include sample sizes,
non-centrality parameter, power, internal S values, and adjusted
frequencies. Trend functions additionally return the trend numerator and
denominator.
Gordon, D., Finch, S. J., & Kim, W. (2020). Heterogeneity in Statistical Genetics: How to Assess, Address, and Account for Mixtures in Association Studies. Springer. doi:10.1007/978-3-030-61121-7.
Armitage, P. (1955). Tests for linear trends in proportions and frequencies. Biometrics, 11(3), 375–386. doi:10.2307/3001775.
Slager, S. L., & Schaid, D. J. (2001). Case-control studies of genetic markers: power and sample size approximations for Armitage's test for trend. Human Heredity, 52(3), 149–153. doi:10.1159/000053370.
cc_power, cc_mssn, and
case_control_genotype_misclassification.
cc_chisq_mssn_locus_heterogeneity( power = 0.8, alpha = 0.05, g_case_assoc = c(0.25, 0.50, 0.25), g_ctrl = c(0.36, 0.48, 0.16), pi = 0.8, verbose = FALSE ) cc_chisq_power_locus_heterogeneity( N_case = 500, alpha = 0.05, g_case_assoc = c(0.25, 0.50, 0.25), g_ctrl = c(0.36, 0.48, 0.16), pi = 0.8, verbose = FALSE ) cc_trend_mssn_locus_heterogeneity( power = 0.8, alpha = 0.05, g_case_assoc = c(0.25, 0.50, 0.25), g_ctrl = c(0.36, 0.48, 0.16), pi = 0.8, verbose = FALSE ) cc_trend_power_locus_heterogeneity( N_case = 500, alpha = 0.05, g_case_assoc = c(0.25, 0.50, 0.25), g_ctrl = c(0.36, 0.48, 0.16), pi = 0.8, verbose = FALSE )cc_chisq_mssn_locus_heterogeneity( power = 0.8, alpha = 0.05, g_case_assoc = c(0.25, 0.50, 0.25), g_ctrl = c(0.36, 0.48, 0.16), pi = 0.8, verbose = FALSE ) cc_chisq_power_locus_heterogeneity( N_case = 500, alpha = 0.05, g_case_assoc = c(0.25, 0.50, 0.25), g_ctrl = c(0.36, 0.48, 0.16), pi = 0.8, verbose = FALSE ) cc_trend_mssn_locus_heterogeneity( power = 0.8, alpha = 0.05, g_case_assoc = c(0.25, 0.50, 0.25), g_ctrl = c(0.36, 0.48, 0.16), pi = 0.8, verbose = FALSE ) cc_trend_power_locus_heterogeneity( N_case = 500, alpha = 0.05, g_case_assoc = c(0.25, 0.50, 0.25), g_ctrl = c(0.36, 0.48, 0.16), pi = 0.8, verbose = FALSE )
Convenience functions for genotype chi-square case-control calculations in
the presence of phenotype misclassification only. These focused functions are
narrower than cc_mssn and
cc_power: they use true affected and true
unaffected genotype frequencies supplied directly by the user and do not
apply locus heterogeneity or genotype misclassification.
cc_chisq_power_phenotype_misclassification( N_case, alpha = 0.05, g_aff, g_unaff, prev, theta = 0, phi = 0, k = 1 ) cc_chisq_mssn_phenotype_misclassification( target_power = 0.8, alpha = 0.05, g_aff, g_unaff, prev, theta = 0, phi = 0, k = 1 )cc_chisq_power_phenotype_misclassification( N_case, alpha = 0.05, g_aff, g_unaff, prev, theta = 0, phi = 0, k = 1 ) cc_chisq_mssn_phenotype_misclassification( target_power = 0.8, alpha = 0.05, g_aff, g_unaff, prev, theta = 0, phi = 0, k = 1 )
N_case |
Numeric |
alpha |
Numeric in |
g_aff |
Numeric vector of true affected genotype frequencies, ordered consistently across affected and unaffected groups and summing to 1. |
g_unaff |
Numeric vector of true unaffected genotype frequencies,
ordered consistently with |
prev |
Numeric in |
theta |
Numeric in |
phi |
Numeric in |
k |
Numeric |
target_power |
Numeric in |
Phenotype misclassification is applied by mixing the true affected genotype
distribution g_aff and true unaffected genotype distribution
g_unaff using disease prevalence and the phenotype-error
probabilities. Here theta = Pr(affected -> control) and
phi = Pr(unaffected -> case). These specialized functions apply only
phenotype misclassification; use the full case-control functions for
combined phenotype misclassification, locus heterogeneity, genotype
misclassification, or trend tests.
The observed case distribution is a prevalence-weighted mixture of true
affected and unaffected genotype probabilities conditional on being
classified as a case; the control distribution is constructed analogously.
cc_chisq_power_phenotype_misclassification() returns a list containing sample sizes,
phenotype-error parameters, observed case/control genotype frequencies,
internal S, non-centrality parameter lambda, and power.
cc_chisq_mssn_phenotype_misclassification() returns a list containing target power,
phenotype-error parameters, observed case/control genotype frequencies,
internal S, target non-centrality parameter lambda_star, and
case/control/total MSSN.
Edwards, B. J., Haynes, C., Levenstien, M. A., Finch, S. J., & Gordon, D. (2005). Power and sample size calculations in the presence of phenotype errors for case/control genetic association studies. BMC Genetics, 6, 18. doi:10.1186/1471-2156-6-18. PMID: 15819990.
Gordon, D., Finch, S. J., & Kim, W. (2020). Heterogeneity in Statistical Genetics: How to Assess, Address, and Account for Mixtures in Association Studies. Springer. doi:10.1007/978-3-030-61121-7.
cc_power, cc_mssn, and
case_control_genotype_misclassification.
g_aff <- c((1 - 0.05)^2, 2 * 0.05 * (1 - 0.05), 0.05^2) g_unaff <- c((1 - 0.15)^2, 2 * 0.15 * (1 - 0.15), 0.15^2) cc_chisq_power_phenotype_misclassification( N_case = 250, alpha = 0.01, g_aff = g_aff, g_unaff = g_unaff, prev = 0.05, theta = 0, phi = 0.01 ) cc_chisq_mssn_phenotype_misclassification( target_power = 0.8, alpha = 0.01, g_aff = g_aff, g_unaff = g_unaff, prev = 0.05, theta = 0, phi = 0.01 )g_aff <- c((1 - 0.05)^2, 2 * 0.05 * (1 - 0.05), 0.05^2) g_unaff <- c((1 - 0.15)^2, 2 * 0.15 * (1 - 0.15), 0.15^2) cc_chisq_power_phenotype_misclassification( N_case = 250, alpha = 0.01, g_aff = g_aff, g_unaff = g_unaff, prev = 0.05, theta = 0, phi = 0.01 ) cc_chisq_mssn_phenotype_misclassification( target_power = 0.8, alpha = 0.01, g_aff = g_aff, g_unaff = g_unaff, prev = 0.05, theta = 0, phi = 0.01 )
Computes the minimum sample size necessary (MSSN) for case-control association tests using conditional genotype frequencies. The function supports model-based genotype frequencies, model-free genotype frequencies, optional locus heterogeneity, optional phenotype misclassification, optional genotype misclassification, genotype chi-square tests, and genotype trend tests.
cc_mssn( power, alpha, input_mode = c("model_based", "model_free"), prev = NULL, pd = NULL, R2 = NULL, MOI = c("M", "D", "Rec"), g1 = NULL, g0 = NULL, locus_het = FALSE, pi = 1, pheno_misclass = FALSE, theta = 0, phi = 0, k = 1, w = c(0, 1, 2), geno_misclass = c("none", "1p", "2p", "3p", "diff3p"), e = 0, e1 = 0, e2 = 0, e01 = 0, e02 = 0, e03 = 0, case_e01 = 0, case_e02 = 0, case_e03 = 0, ctrl_e01 = 0, ctrl_e02 = 0, ctrl_e03 = 0, diff_source = c("explicit", "case", "ctrl"), diff_multiplier = 1, verbose = TRUE )cc_mssn( power, alpha, input_mode = c("model_based", "model_free"), prev = NULL, pd = NULL, R2 = NULL, MOI = c("M", "D", "Rec"), g1 = NULL, g0 = NULL, locus_het = FALSE, pi = 1, pheno_misclass = FALSE, theta = 0, phi = 0, k = 1, w = c(0, 1, 2), geno_misclass = c("none", "1p", "2p", "3p", "diff3p"), e = 0, e1 = 0, e2 = 0, e01 = 0, e02 = 0, e03 = 0, case_e01 = 0, case_e02 = 0, case_e03 = 0, ctrl_e01 = 0, ctrl_e02 = 0, ctrl_e03 = 0, diff_source = c("explicit", "case", "ctrl"), diff_multiplier = 1, verbose = TRUE )
power |
Numeric in |
alpha |
Numeric in |
input_mode |
Character. One of |
prev |
Numeric in |
pd |
Numeric in |
R2 |
Numeric |
MOI |
Character. Mode of inheritance for model-based frequencies:
|
g1, g0
|
Numeric vectors of length 3 for |
locus_het |
Logical. If |
pi |
Numeric in |
pheno_misclass |
Logical. If |
theta |
Numeric in |
phi |
Numeric in |
k |
Numeric |
w |
Numeric vector of length 3. Genotype trend-test scores. The three weights cannot all be equal. |
geno_misclass |
Character. Genotype misclassification model:
|
e |
Numeric in |
e1, e2
|
Numeric. Two-parameter misclassification rates for
|
e01, e02, e03
|
Numeric. Non-differential three-parameter
misclassification rates for |
case_e01, case_e02, case_e03
|
Numeric. Case-specific three-parameter
misclassification rates for |
ctrl_e01, ctrl_e02, ctrl_e03
|
Numeric. Control-specific three-parameter
misclassification rates for |
diff_source |
Character. For |
diff_multiplier |
Numeric |
verbose |
Logical. If |
The no-error scenario is always calculated from the baseline conditional case and control genotype frequencies. Each requested modifier is evaluated independently from that same baseline:
no error: baseline -> tests;
phenotype misclassification: baseline -> phenotype misclassification -> tests;
locus heterogeneity: baseline -> locus heterogeneity -> tests;
genotype misclassification: baseline -> genotype misclassification -> tests.
Supplying several modifiers requests several independent sensitivity
scenarios. Ordinary cc_mssn() does not combine modifiers. Specialized
joint-error methods such as LRTae and LTTae are separate methods and are not
implemented here.
With input_mode = "model_based", conditional case and control genotype
frequencies are derived from prev, pd, R2, and
MOI using Chapter 1, Section 1.4.2, Eqs. 1.6–1.7 (p. 13) of
Gordon, Finch, and Kim (2020). With input_mode = "model_free", the user supplies
g1 and g0 directly; when phenotype misclassification is
enabled, g1 is treated as the true affected genotype distribution and
g0 is treated as the true unaffected genotype distribution.
Phenotype misclassification requires prev in both input modes because
disease prevalence is used to mix the baseline affected and unaffected
genotype distributions into observed case and control distributions. Locus
heterogeneity uses
and leaves
controls unchanged. Genotype misclassification matrices are likewise applied
directly to baseline case and control frequencies.
The genotype misclassification models are:
"none" for identity matrices, "1p" for one symmetric error
rate, "2p" for adjacent homozygote/heterozygote and heterozygote
error rates, "3p" for a non-differential three-parameter matrix, and
"diff3p" for separate case and control three-parameter matrices.
The one-, two-, and three-parameter matrices correspond to textbook
Eqs. 2.5, 2.6, and 2.7 (pp. 57–58). For "1p", package e
is the probability in each adjacent off-diagonal cell and the diagonal is
; textbook Eq. 2.5 uses off-diagonal , so
.
The genotype test uses Eq. 1.22 (p. 26). The trend test is defined by
Eqs. 1.20–1.21 (p. 24) and uses the NCP in Eq. 1.24 (p. 27). Locus
heterogeneity follows Eq. 2.16 (p. 88): pi is the homogeneous
fraction and is the heterogeneous fraction. Its trend-test
construction corresponds to Eqs. 5.29a–b (pp. 287–288).
For geno_misclass = "diff3p", diff_source = "explicit" uses
the case and control error parameters exactly as supplied. With
diff_source = "case", control parameters are computed by multiplying
the case parameters by diff_multiplier. With
diff_source = "ctrl", case parameters are computed by multiplying the
control parameters by diff_multiplier.
With geno_misclass = "diff3p", returned MSSNs are nominal,
asymptotic values evaluated with the usual chi-square critical value.
Different case and control error mechanisms can distort the null
distribution and inflate type I error. This function does not independently
recalibrate that null distribution for arbitrary differential genotyping
error.
Internal effect-size components S are retained in the returned object
for validation and debugging, but are not printed in the clean verbose
output.
An object of class "cc_mssn", containing:
Requested significance level and power.
Input mode, control-to-case ratio, trend scores, and locus-heterogeneity settings.
Genotype-error model and matrices, plus phenotype-error settings and intermediate frequencies.
Model-based penetrances and risk-model inputs, or model-free identifying information.
Named independent results. no_error always exists;
requested modifiers add phenotype_misclassification,
heterogeneity, and genotype_misclassification. Each contains
scenario frequencies, modifier metadata, and genotype/trend MSSN results.
Compatibility fields. With zero
or one modifier, they mirror the sole design previously returned. With
several modifiers, they explicitly mirror no_error; use
scenarios for each sensitivity result.
Gordon, D., Finch, S. J., & Kim, W. (2020). Heterogeneity in Statistical Genetics: How to Assess, Address, and Account for Mixtures in Association Studies. Springer. doi:10.1007/978-3-030-61121-7.
Gordon, D., Finch, S. J., Nothnagel, M., & Ott, J. (2002). Power and sample size calculations for case-control genetic association tests when errors are present: application to single nucleotide polymorphisms. Human Heredity, 54(1), 22–33. doi:10.1159/000066696.
Armitage, P. (1955). Tests for linear trends in proportions and frequencies. Biometrics, 11(3), 375–386. doi:10.2307/3001775.
Slager, S. L., & Schaid, D. J. (2001). Case-control studies of genetic markers: power and sample size approximations for Armitage's test for trend. Human Heredity, 52(3), 149–153. doi:10.1159/000053370.
Edwards, B. J., Haynes, C., Levenstien, M. A., Finch, S. J., & Gordon, D. (2005). Power and sample size calculations in the presence of phenotype errors for case/control genetic association studies. BMC Genetics, 6, 18. doi:10.1186/1471-2156-6-18.
cc_power,
case_control_genotype_misclassification,
case_control_locus_heterogeneity, and
case_control_phenotype_misclassification.
cc_mssn( power = 0.8, alpha = 0.05, input_mode = "model_free", g1 = c(0.25, 0.50, 0.25), g0 = c(0.36, 0.48, 0.16), geno_misclass = "none", verbose = FALSE ) cc_mssn( power = 0.8, alpha = 0.05, input_mode = "model_free", g1 = c(0.25, 0.50, 0.25), g0 = c(0.36, 0.48, 0.16), locus_het = TRUE, pi = 0.8, verbose = FALSE ) cc_mssn( power = 0.8, alpha = 0.05, input_mode = "model_free", g1 = c(0.25, 0.50, 0.25), g0 = c(0.36, 0.48, 0.16), locus_het = TRUE, pi = 0.8, geno_misclass = "3p", e01 = 0.02, e02 = 0.01, e03 = 0.005, verbose = FALSE ) cc_mssn( power = 0.8, alpha = 0.05, input_mode = "model_free", g1 = c(0.25, 0.50, 0.25), g0 = c(0.36, 0.48, 0.16), prev = 0.05, pheno_misclass = TRUE, theta = 0.05, phi = 0.01, verbose = FALSE )cc_mssn( power = 0.8, alpha = 0.05, input_mode = "model_free", g1 = c(0.25, 0.50, 0.25), g0 = c(0.36, 0.48, 0.16), geno_misclass = "none", verbose = FALSE ) cc_mssn( power = 0.8, alpha = 0.05, input_mode = "model_free", g1 = c(0.25, 0.50, 0.25), g0 = c(0.36, 0.48, 0.16), locus_het = TRUE, pi = 0.8, verbose = FALSE ) cc_mssn( power = 0.8, alpha = 0.05, input_mode = "model_free", g1 = c(0.25, 0.50, 0.25), g0 = c(0.36, 0.48, 0.16), locus_het = TRUE, pi = 0.8, geno_misclass = "3p", e01 = 0.02, e02 = 0.01, e03 = 0.005, verbose = FALSE ) cc_mssn( power = 0.8, alpha = 0.05, input_mode = "model_free", g1 = c(0.25, 0.50, 0.25), g0 = c(0.36, 0.48, 0.16), prev = 0.05, pheno_misclass = TRUE, theta = 0.05, phi = 0.01, verbose = FALSE )
Computes the minimum sample size necessary (MSSN) for a model-based
case-control sequencing trend design. It evaluates the same independent
sequencing-only, phenotype, heterogeneity, and post-call genotype-error
scenarios as cc_ngs_power.
cc_ngs_mssn( power, alpha, prev, pd, R2, coverage = NULL, seq_error = NULL, MOI = c("M", "D", "Rec"), k = 1, verbose = TRUE, locus_het = FALSE, pi = 1, case_coverage = coverage, ctrl_coverage = coverage, case_seq_error = seq_error, ctrl_seq_error = seq_error, pheno_misclass = FALSE, theta = 0, phi = 0, geno_misclass = c("none", "1p", "2p", "3p", "diff3p"), e = 0, e1 = 0, e2 = 0, e01 = 0, e02 = 0, e03 = 0, case_e01 = 0, case_e02 = 0, case_e03 = 0, ctrl_e01 = 0, ctrl_e02 = 0, ctrl_e03 = 0, diff_source = c("explicit", "case", "ctrl"), diff_multiplier = 1 )cc_ngs_mssn( power, alpha, prev, pd, R2, coverage = NULL, seq_error = NULL, MOI = c("M", "D", "Rec"), k = 1, verbose = TRUE, locus_het = FALSE, pi = 1, case_coverage = coverage, ctrl_coverage = coverage, case_seq_error = seq_error, ctrl_seq_error = seq_error, pheno_misclass = FALSE, theta = 0, phi = 0, geno_misclass = c("none", "1p", "2p", "3p", "diff3p"), e = 0, e1 = 0, e2 = 0, e01 = 0, e02 = 0, e03 = 0, case_e01 = 0, case_e02 = 0, case_e03 = 0, ctrl_e01 = 0, ctrl_e02 = 0, ctrl_e03 = 0, diff_source = c("explicit", "case", "ctrl"), diff_multiplier = 1 )
power |
Numeric in |
alpha |
Numeric in |
prev |
Numeric in |
pd |
Numeric in |
R2 |
Numeric |
coverage |
Common positive integer fixed sequencing depth. May be omitted when both group-specific depths are supplied. |
seq_error |
Symmetric per-read sequencing-error probability in
|
MOI |
Character mode of inheritance: |
k |
Numeric |
verbose |
Logical. If |
locus_het |
Logical. If |
pi |
Numeric in |
case_coverage, ctrl_coverage
|
Case/control fixed depths, respectively.
Each defaults to |
case_seq_error, ctrl_seq_error
|
Case/control per-read error probabilities.
Each defaults to |
pheno_misclass |
Logical. If |
theta |
Numeric in |
phi |
Numeric in |
geno_misclass |
Character genotype-misclassification model:
|
e |
Numeric in |
e1, e2
|
Numeric two-parameter homozygote-to-heterozygote and heterozygote-to-homozygote error rates. |
e01, e02, e03
|
Numeric non-differential three-parameter error rates. |
case_e01, case_e02, case_e03
|
Case-specific three-parameter error rates. |
ctrl_e01, ctrl_e02, ctrl_e03
|
Control-specific three-parameter error rates. |
diff_source |
Character source for differential three-parameter errors:
|
diff_multiplier |
Nonnegative multiplier used to derive the other
group's rates when |
Locus heterogeneity uses
in its independent branch.
The prevalence-weighted phenotype transformation from
cc_mssn is applied directly to the common biological baseline
in its branch. Case and control sequencing settings are then applied to the
corresponding pre-sequencing groups. Conventional genotype
misclassification is applied after sequencing only in its own branch. See
cc_ngs_power for the scenario paths and matrix convention.
When and sequencing mechanisms are equal, no finite MSSN exists
for target power greater than alpha if the observed contrast is zero.
Differential mechanisms may create an observed contrast even under a
biological null. MSSN is a nominal asymptotic calculation using the existing
chi-square critical value, without separate null-distribution or Type I error
recalibration.
The function numerically inverts the one-degree-of-freedom noncentral
chi-square distribution only to obtain the target NCP. It then solves the
Ahn/Chapman-Nam trend-test sample-size equation analytically. Planned cases
are the ceiling of the continuous requirement and planned controls are
ceiling(k * MSSN_case), following the PAWEH convention. Achieved NCP
and power are recomputed using these actual integer sample sizes, with a
local boundary adjustment if required to ensure target attainment and
integer minimality.
Scores are c(0,1,2) for "M", c(0,1,1) for
"D", and c(0,0,1) for "Rec". Finite depth can cause
genotype-call uncertainty even when seq_error = 0, because a true
heterozygote can yield reads from only one allele.
This is an analytic study-design calculation, not LTTae,NGS, a raw-read latent-genotype likelihood or EM method, downstream association testing, or simulation.
Invisibly, an object of class "cc_ngs_mssn" containing a
scenario-first scenarios list. Each scenario records target NCP,
D/Q, continuous and integer sample sizes, achieved NCP and
power, rounding metadata, staged frequencies, and sequencing/error
matrices. Legacy fields follow the compatibility_scenario
convention documented for cc_ngs_power.
Ahn, K., Haynes, C., Kim, W., St. Fleur, R., Gordon, D., & Finch, S. J. (2007). The effects of SNP genotyping errors on the power of the Cochran-Armitage linear trend test for case/control association studies. Annals of Human Genetics, 71, 249–261. doi:10.1111/j.1469-1809.2006.00318.x.
Gordon, D., Finch, S. J., & Kim, W. (2020). Heterogeneity in Statistical Genetics. Springer. doi:10.1007/978-3-030-61121-7.
cc_ngs_mssn( power = 0.80, alpha = 0.05, prev = 0.05, pd = 0.30, R2 = 1.8, coverage = 20, seq_error = 0.01, MOI = "M", verbose = FALSE )cc_ngs_mssn( power = 0.80, alpha = 0.05, prev = 0.05, pd = 0.30, R2 = 1.8, coverage = 20, seq_error = 0.01, MOI = "M", verbose = FALSE )
Computes prospective asymptotic power for a model-based case-control sequencing design. Sequencing is the common reference mechanism. Optional phenotype misclassification, locus heterogeneity, and conventional genotype misclassification are evaluated as independent sensitivity scenarios from the same biological baseline and sequencing design.
cc_ngs_power( N_case, alpha, prev, pd, R2, coverage = NULL, seq_error = NULL, MOI = c("M", "D", "Rec"), k = 1, verbose = TRUE, locus_het = FALSE, pi = 1, case_coverage = coverage, ctrl_coverage = coverage, case_seq_error = seq_error, ctrl_seq_error = seq_error, pheno_misclass = FALSE, theta = 0, phi = 0, geno_misclass = c("none", "1p", "2p", "3p", "diff3p"), e = 0, e1 = 0, e2 = 0, e01 = 0, e02 = 0, e03 = 0, case_e01 = 0, case_e02 = 0, case_e03 = 0, ctrl_e01 = 0, ctrl_e02 = 0, ctrl_e03 = 0, diff_source = c("explicit", "case", "ctrl"), diff_multiplier = 1 )cc_ngs_power( N_case, alpha, prev, pd, R2, coverage = NULL, seq_error = NULL, MOI = c("M", "D", "Rec"), k = 1, verbose = TRUE, locus_het = FALSE, pi = 1, case_coverage = coverage, ctrl_coverage = coverage, case_seq_error = seq_error, ctrl_seq_error = seq_error, pheno_misclass = FALSE, theta = 0, phi = 0, geno_misclass = c("none", "1p", "2p", "3p", "diff3p"), e = 0, e1 = 0, e2 = 0, e01 = 0, e02 = 0, e03 = 0, case_e01 = 0, case_e02 = 0, case_e03 = 0, ctrl_e01 = 0, ctrl_e02 = 0, ctrl_e03 = 0, diff_source = c("explicit", "case", "ctrl"), diff_multiplier = 1 )
N_case |
Numeric |
alpha |
Numeric in |
prev |
Numeric in |
pd |
Numeric in |
R2 |
Numeric |
coverage |
Common positive integer fixed sequencing depth. May be omitted when both group-specific depths are supplied. |
seq_error |
Symmetric per-read sequencing-error probability in
|
MOI |
Character mode of inheritance: |
k |
Numeric |
verbose |
Logical. If |
locus_het |
Logical. If |
pi |
Numeric in |
case_coverage, ctrl_coverage
|
Case/control fixed depths, respectively.
Each defaults to |
case_seq_error, ctrl_seq_error
|
Case/control per-read error probabilities.
Each defaults to |
pheno_misclass |
Logical. If |
theta |
Numeric in |
phi |
Numeric in |
geno_misclass |
Character genotype-misclassification model:
|
e |
Numeric in |
e1, e2
|
Numeric two-parameter homozygote-to-heterozygote and heterozygote-to-homozygote error rates. |
e01, e02, e03
|
Numeric non-differential three-parameter error rates. |
case_e01, case_e02, case_e03
|
Case-specific three-parameter error rates. |
ctrl_e01, ctrl_e02, ctrl_e03
|
Control-specific three-parameter error rates. |
diff_source |
Character source for differential three-parameter errors:
|
diff_multiplier |
Nonnegative multiplier used to derive the other
group's rates when |
Trend scores are selected from MOI: "M" uses
c(0,1,2), "D" uses c(0,1,1), and "Rec" uses
c(0,0,1). Power is the upper-tail probability beyond the central
one-degree-of-freedom chi-square critical value under a noncentral
chi-square distribution with the calculated NCP.
Locus heterogeneity uses the same parameterization as ordinary PAWEH case-control design:
with the control distribution unchanged. The scenario paths are:
sequencing only, baseline to sequencing to test; phenotype, baseline to
phenotype misclassification to sequencing to test; heterogeneity, baseline
to locus heterogeneity to sequencing to test; and genotype, baseline to
sequencing to conventional genotype misclassification to test. Supplying
multiple modifiers returns multiple independent scenarios; modifiers are
not combined.
The same effective case/control coverage and sequencing-error settings are
used in every scenario.
Phenotype misclassification uses the same prevalence-weighted transformation
as cc_power, with
theta = Pr(affected -> control) and
phi = Pr(unaffected -> case). The resulting observed-case and
observed-control distributions enter sequencing. Separate row-true,
column-called matrices are then constructed using each observed group's
effective depth and error, and applied as t(M_case) %*% g_case and
t(M_ctrl) %*% g_control. The ordinary PAWEH 1p, 2p, 3p, or differential
3p genotype-error matrices are applied only in their independent scenario,
after sequencing calls, with the same row-current, column-observed
convention.
Only equal sequencing mechanisms permit commuting
a shared biological mixture and sequencing. At , equal mechanisms
with no phenotype-induced difference give zero NCP and power equal to
alpha.
Differential sequencing or genotype-misclassification mechanisms can create observed case/control differences even under a biological null. Results remain nominal asymptotic calculations using the existing chi-square critical value; the null distribution and Type I error are not separately recalibrated here.
This is an analytic study-design calculation applied to sequencing-derived
called genotypes. It is not a raw-read likelihood or EM analysis, performs
no downstream association testing, and uses no simulation. Even when
seq_error = 0, finite depth can cause call uncertainty because a true
heterozygote can yield reads from only one allele.
Invisibly, an object of class "cc_ngs_power". The
scenarios list always contains sequencing_only and each
explicitly requested modifier scenario. Every scenario records staged
frequencies, sequencing and error matrices, Ahn components D and
Q, NCP, and power. Legacy top-level result fields mirror sequencing
only with zero or multiple optional modifiers and the requested modifier
with exactly one; compatibility_scenario identifies it. The
frequency list distinguishes
post-sequencing calls from final post-genotype-misclassification values.
The sequencing list records the four effective group parameters and
case_transition_matrix/ctrl_transition_matrix. Legacy
coverage/seq_error retain supplied common inputs (or NULL);
transition_matrix aliases the case matrix, shared when mechanisms
are equal. Use the two explicit matrices for differential designs.
Ahn, K., Haynes, C., Kim, W., St. Fleur, R., Gordon, D., & Finch, S. J. (2007). The effects of SNP genotyping errors on the power of the Cochran-Armitage linear trend test for case/control association studies. Annals of Human Genetics, 71, 249–261. doi:10.1111/j.1469-1809.2006.00318.x.
Gordon, D., Finch, S. J., & Kim, W. (2020). Heterogeneity in Statistical Genetics. Springer. doi:10.1007/978-3-030-61121-7.
cc_ngs_power( N_case = 1000, alpha = 0.05, prev = 0.05, pd = 0.30, R2 = 1.8, coverage = 20, seq_error = 0.01, MOI = "M", verbose = FALSE )cc_ngs_power( N_case = 1000, alpha = 0.05, prev = 0.05, pd = 0.30, R2 = 1.8, coverage = 20, seq_error = 0.01, MOI = "M", verbose = FALSE )
Computes power for fixed case-control sample sizes using conditional genotype frequencies. The function supports model-based genotype frequencies, model-free genotype frequencies, optional locus heterogeneity, optional phenotype misclassification, optional genotype misclassification, genotype chi-square tests and genotype trend tests.
cc_power( N_case, alpha, input_mode = c("model_based", "model_free"), prev = NULL, pd = NULL, R2 = NULL, MOI = c("M", "D", "Rec"), g1 = NULL, g0 = NULL, locus_het = FALSE, pi = 1, pheno_misclass = FALSE, theta = 0, phi = 0, k = 1, w = c(0, 1, 2), geno_misclass = c("none", "1p", "2p", "3p", "diff3p"), e = 0, e1 = 0, e2 = 0, e01 = 0, e02 = 0, e03 = 0, case_e01 = 0, case_e02 = 0, case_e03 = 0, ctrl_e01 = 0, ctrl_e02 = 0, ctrl_e03 = 0, diff_source = c("explicit", "case", "ctrl"), diff_multiplier = 1, verbose = TRUE )cc_power( N_case, alpha, input_mode = c("model_based", "model_free"), prev = NULL, pd = NULL, R2 = NULL, MOI = c("M", "D", "Rec"), g1 = NULL, g0 = NULL, locus_het = FALSE, pi = 1, pheno_misclass = FALSE, theta = 0, phi = 0, k = 1, w = c(0, 1, 2), geno_misclass = c("none", "1p", "2p", "3p", "diff3p"), e = 0, e1 = 0, e2 = 0, e01 = 0, e02 = 0, e03 = 0, case_e01 = 0, case_e02 = 0, case_e03 = 0, ctrl_e01 = 0, ctrl_e02 = 0, ctrl_e03 = 0, diff_source = c("explicit", "case", "ctrl"), diff_multiplier = 1, verbose = TRUE )
N_case |
Numeric |
alpha |
Numeric in |
input_mode |
Character. One of |
prev |
Numeric in |
pd |
Numeric in |
R2 |
Numeric |
MOI |
Character. Mode of inheritance for model-based frequencies:
|
g1, g0
|
Numeric vectors of length 3 for |
locus_het |
Logical. If |
pi |
Numeric in |
pheno_misclass |
Logical. If |
theta |
Numeric in |
phi |
Numeric in |
k |
Numeric |
w |
Numeric vector of length 3. Genotype trend-test scores. The three weights cannot all be equal. |
geno_misclass |
Character. Genotype misclassification model:
|
e |
Numeric in |
e1, e2
|
Numeric. Two-parameter misclassification rates for
|
e01, e02, e03
|
Numeric. Non-differential three-parameter
misclassification rates for |
case_e01, case_e02, case_e03
|
Numeric. Case-specific three-parameter
misclassification rates for |
ctrl_e01, ctrl_e02, ctrl_e03
|
Numeric. Control-specific three-parameter
misclassification rates for |
diff_source |
Character. For |
diff_multiplier |
Numeric |
verbose |
Logical. If |
The no-error scenario is always calculated from the baseline conditional case and control genotype frequencies. Each requested modifier is evaluated independently from that same baseline:
no error: baseline -> tests;
phenotype misclassification: baseline -> phenotype misclassification -> tests;
locus heterogeneity: baseline -> locus heterogeneity -> tests;
genotype misclassification: baseline -> genotype misclassification -> tests.
Supplying several modifiers requests several independent sensitivity
scenarios. Ordinary cc_power() does not combine modifiers. Specialized
joint-error methods such as LRTae and LTTae are separate methods and are not
implemented here.
With input_mode = "model_based", conditional case and control genotype
frequencies are derived from prev, pd, R2, and
MOI using Chapter 1, Section 1.4.2, Eqs. 1.6–1.7 (p. 13) of
Gordon, Finch, and Kim (2020). With input_mode = "model_free", the user supplies
g1 and g0 directly; when phenotype misclassification is
enabled, g1 is treated as the true affected genotype distribution and
g0 is treated as the true unaffected genotype distribution.
Phenotype misclassification requires prev in both input modes because
disease prevalence is used to mix the baseline affected and unaffected
genotype distributions into observed case and control distributions. Locus
heterogeneity uses
and leaves
controls unchanged. Genotype misclassification matrices are likewise applied
directly to baseline case and control frequencies.
The genotype misclassification models are:
"none" for identity matrices, "1p" for one symmetric error
rate, "2p" for adjacent homozygote/heterozygote and heterozygote
error rates, "3p" for a non-differential three-parameter matrix, and
"diff3p" for separate case and control three-parameter matrices.
These matrices correspond to Eqs. 2.5–2.7 (pp. 57–58). For "1p",
package e is the probability in each adjacent off-diagonal cell and
the diagonal is ; textbook Eq. 2.5 uses off-diagonal
, so . The genotype and trend tests use
Eqs. 1.22 and 1.24 (pp. 26–27), with the trend statistic defined by
Eqs. 1.20–1.21 (p. 24). Locus heterogeneity follows Eq. 2.16 (p. 88), where
pi is the homogeneous fraction; its trend-test form is given in
Eqs. 5.29a–b (pp. 287–288).
For geno_misclass = "diff3p", diff_source = "explicit" uses
the case and control error parameters exactly as supplied. With
diff_source = "case", control parameters are computed by multiplying
the case parameters by diff_multiplier. With
diff_source = "ctrl", case parameters are computed by multiplying the
control parameters by diff_multiplier.
With geno_misclass = "diff3p", returned power is nominal asymptotic
power evaluated with the usual chi-square critical value. Different case
and control error mechanisms can distort the null distribution and inflate
type I error. This function does not independently recalibrate the null
distribution for arbitrary differential genotyping error.
Internal effect-size components S are retained in the returned object
for validation and debugging, but are not printed in the clean verbose
output.
An object of class "cc_power", containing:
Significance level and numbers of case, control, and total individuals.
Input mode, control-to-case ratio, trend scores, and locus-heterogeneity settings.
Genotype-error model and matrices, plus phenotype-error settings and intermediate frequencies.
Model-based penetrances and risk-model inputs, or model-free identifying information.
Named independent results. no_error always exists;
requested modifiers add phenotype_misclassification,
heterogeneity, and genotype_misclassification. Each contains
scenario frequencies, modifier metadata, and genotype/trend power results.
Compatibility fields. With zero
or one modifier, they mirror the sole design previously returned. With
several modifiers, they explicitly mirror no_error; use
scenarios for each sensitivity result.
Gordon, D., Finch, S. J., & Kim, W. (2020). Heterogeneity in Statistical Genetics: How to Assess, Address, and Account for Mixtures in Association Studies. Springer. doi:10.1007/978-3-030-61121-7.
Gordon, D., Finch, S. J., Nothnagel, M., & Ott, J. (2002). Power and sample size calculations for case-control genetic association tests when errors are present: application to single nucleotide polymorphisms. Human Heredity, 54(1), 22–33. doi:10.1159/000066696.
Armitage, P. (1955). Tests for linear trends in proportions and frequencies. Biometrics, 11(3), 375–386. doi:10.2307/3001775.
Slager, S. L., & Schaid, D. J. (2001). Case-control studies of genetic markers: power and sample size approximations for Armitage's test for trend. Human Heredity, 52(3), 149–153. doi:10.1159/000053370.
Edwards, B. J., Haynes, C., Levenstien, M. A., Finch, S. J., & Gordon, D. (2005). Power and sample size calculations in the presence of phenotype errors for case/control genetic association studies. BMC Genetics, 6, 18. doi:10.1186/1471-2156-6-18.
cc_mssn,
case_control_genotype_misclassification,
case_control_locus_heterogeneity, and
case_control_phenotype_misclassification.
cc_power( N_case = 500, alpha = 0.05, input_mode = "model_free", g1 = c(0.25, 0.50, 0.25), g0 = c(0.36, 0.48, 0.16), geno_misclass = "none", verbose = FALSE ) cc_power( N_case = 500, alpha = 0.05, input_mode = "model_free", g1 = c(0.25, 0.50, 0.25), g0 = c(0.36, 0.48, 0.16), locus_het = TRUE, pi = 0.8, verbose = FALSE ) cc_power( N_case = 500, alpha = 0.05, input_mode = "model_free", g1 = c(0.25, 0.50, 0.25), g0 = c(0.36, 0.48, 0.16), locus_het = TRUE, pi = 0.8, geno_misclass = "3p", e01 = 0.02, e02 = 0.01, e03 = 0.005, verbose = FALSE ) cc_power( N_case = 500, alpha = 0.05, input_mode = "model_based", prev = 0.05, pd = 0.30, R2 = 1.8, MOI = "M", pheno_misclass = TRUE, theta = 0.05, phi = 0.01, verbose = FALSE ) cc_power( N_case = 500, alpha = 0.05, input_mode = "model_based", prev = 0.05, pd = 0.30, R2 = 1.8, MOI = "M", locus_het = TRUE, pi = 0.8, geno_misclass = "3p", e01 = 0.02, e02 = 0.01, e03 = 0.005, verbose = FALSE ) cc_power( N_case = 500, alpha = 0.05, input_mode = "model_free", g1 = c(0.25, 0.50, 0.25), g0 = c(0.36, 0.48, 0.16), geno_misclass = "diff3p", diff_source = "explicit", case_e01 = 0.02, case_e02 = 0.01, case_e03 = 0.005, ctrl_e01 = 0.01, ctrl_e02 = 0.005, ctrl_e03 = 0.002, verbose = FALSE ) cc_power( N_case = 500, alpha = 0.05, input_mode = "model_free", g1 = c(0.25, 0.50, 0.25), g0 = c(0.36, 0.48, 0.16), geno_misclass = "diff3p", diff_source = "case", diff_multiplier = 0.5, case_e01 = 0.02, case_e02 = 0.01, case_e03 = 0.005, verbose = FALSE )cc_power( N_case = 500, alpha = 0.05, input_mode = "model_free", g1 = c(0.25, 0.50, 0.25), g0 = c(0.36, 0.48, 0.16), geno_misclass = "none", verbose = FALSE ) cc_power( N_case = 500, alpha = 0.05, input_mode = "model_free", g1 = c(0.25, 0.50, 0.25), g0 = c(0.36, 0.48, 0.16), locus_het = TRUE, pi = 0.8, verbose = FALSE ) cc_power( N_case = 500, alpha = 0.05, input_mode = "model_free", g1 = c(0.25, 0.50, 0.25), g0 = c(0.36, 0.48, 0.16), locus_het = TRUE, pi = 0.8, geno_misclass = "3p", e01 = 0.02, e02 = 0.01, e03 = 0.005, verbose = FALSE ) cc_power( N_case = 500, alpha = 0.05, input_mode = "model_based", prev = 0.05, pd = 0.30, R2 = 1.8, MOI = "M", pheno_misclass = TRUE, theta = 0.05, phi = 0.01, verbose = FALSE ) cc_power( N_case = 500, alpha = 0.05, input_mode = "model_based", prev = 0.05, pd = 0.30, R2 = 1.8, MOI = "M", locus_het = TRUE, pi = 0.8, geno_misclass = "3p", e01 = 0.02, e02 = 0.01, e03 = 0.005, verbose = FALSE ) cc_power( N_case = 500, alpha = 0.05, input_mode = "model_free", g1 = c(0.25, 0.50, 0.25), g0 = c(0.36, 0.48, 0.16), geno_misclass = "diff3p", diff_source = "explicit", case_e01 = 0.02, case_e02 = 0.01, case_e03 = 0.005, ctrl_e01 = 0.01, ctrl_e02 = 0.005, ctrl_e03 = 0.002, verbose = FALSE ) cc_power( N_case = 500, alpha = 0.05, input_mode = "model_free", g1 = c(0.25, 0.50, 0.25), g0 = c(0.36, 0.48, 0.16), geno_misclass = "diff3p", diff_source = "case", diff_multiplier = 0.5, case_e01 = 0.02, case_e02 = 0.01, case_e03 = 0.005, verbose = FALSE )
Finds the minimum integer total sample size required to attain a requested prospective LRTae power while preserving a requested allocation among the four measurement and validation tiers as closely as integer counts permit. This is a prospective-design calculation and is not an observed-data test.
lrtae_mssn( true_control_genotype_frequencies, true_case_genotype_frequencies, true_sampling_proportions, phenotype_misclassification_matrix, genotype_misclassification_matrix, target_power, alpha, prop_fallible, prop_pheno_validated, prop_geno_validated, prop_both_validated )lrtae_mssn( true_control_genotype_frequencies, true_case_genotype_frequencies, true_sampling_proportions, phenotype_misclassification_matrix, genotype_misclassification_matrix, target_power, alpha, prop_fallible, prop_pheno_validated, prop_geno_validated, prop_both_validated )
true_control_genotype_frequencies |
Numeric vector of true genotype frequencies among controls. |
true_case_genotype_frequencies |
Numeric vector of true genotype
frequencies among cases, in the same category order as
|
true_sampling_proportions |
Numeric vector of length two containing the true control and case sampling proportions, in that order. |
phenotype_misclassification_matrix |
Numeric two-by-two matrix whose rows are true phenotype categories (control, case) and whose columns are observed phenotype categories (control, case). |
genotype_misclassification_matrix |
Numeric square matrix whose rows are true genotype categories and whose columns are observed genotype categories, in the genotype-frequency order. |
target_power |
Requested power, strictly greater than |
alpha |
Significance level, strictly between zero and one. |
prop_fallible |
Proportion allocated to fallible phenotype and genotype measurements only. |
prop_pheno_validated |
Proportion allocated to phenotype validation with fallible genotype measurement. |
prop_geno_validated |
Proportion allocated to genotype validation with fallible phenotype measurement. |
prop_both_validated |
Proportion allocated to validation of both phenotype and genotype. |
The four allocation proportions must be nonnegative and sum to one.
For every candidate total N, integer counts are assigned by the
largest-remainder (Hamilton) rule: floor N * proportion for each tier,
then distribute the remaining individuals in descending order of fractional
remainder. Exact ties are resolved in the fixed order: fallible, phenotype
validated, genotype validated, both validated. Thus allocated counts always
sum exactly to N.
The search doubles an upper bound until it attains target_power, applies
integer binary search within the bracket, and explicitly verifies the
neighboring design at N - 1. Power at each candidate is evaluated through
lrtae_power(), which uses the validated corrected lrtae_ncp() engine,
k - 1 degrees of freedom, and a noncentral chi-square distribution.
An object of class lrtae_mssn, containing MSSN_total,
target_power, achieved_power, achieved_ncp, df, alpha,
critical_value, requested allocation proportions, and the four allocated
integer tier counts.
lrtae_mssn( true_control_genotype_frequencies = c(0.81, 0.18, 0.01), true_case_genotype_frequencies = c(0.64, 0.32, 0.04), true_sampling_proportions = c(0.5, 0.5), phenotype_misclassification_matrix = matrix( c(0.95, 0.05, 0.05, 0.95), 2, byrow = TRUE ), genotype_misclassification_matrix = matrix( c(0.950, 0.050, 0.000, 0.025, 0.950, 0.025, 0.000, 0.050, 0.950), 3, byrow = TRUE ), target_power = 0.80, alpha = 0.05, prop_fallible = 0.7, prop_pheno_validated = 0.1, prop_geno_validated = 0.1, prop_both_validated = 0.1 )lrtae_mssn( true_control_genotype_frequencies = c(0.81, 0.18, 0.01), true_case_genotype_frequencies = c(0.64, 0.32, 0.04), true_sampling_proportions = c(0.5, 0.5), phenotype_misclassification_matrix = matrix( c(0.95, 0.05, 0.05, 0.95), 2, byrow = TRUE ), genotype_misclassification_matrix = matrix( c(0.950, 0.050, 0.000, 0.025, 0.950, 0.025, 0.000, 0.050, 0.950), 3, byrow = TRUE ), target_power = 0.80, alpha = 0.05, prop_fallible = 0.7, prop_pheno_validated = 0.1, prop_geno_validated = 0.1, prop_both_validated = 0.1 )
Computes the analytic noncentrality parameter (NCP) for the likelihood-ratio test allowing for error (LRTae) in a prospective case-control design. The calculation incorporates fallible measurements and validation subsamples for phenotype, genotype, or both. It does not analyze observed study data.
lrtae_ncp( true_control_genotype_frequencies, true_case_genotype_frequencies, true_sampling_proportions, phenotype_misclassification_matrix, genotype_misclassification_matrix, n_fallible, n_pheno_validated, n_geno_validated, n_both_validated )lrtae_ncp( true_control_genotype_frequencies, true_case_genotype_frequencies, true_sampling_proportions, phenotype_misclassification_matrix, genotype_misclassification_matrix, n_fallible, n_pheno_validated, n_geno_validated, n_both_validated )
true_control_genotype_frequencies |
Numeric vector of true genotype frequencies among controls. |
true_case_genotype_frequencies |
Numeric vector of true genotype
frequencies among cases, in the same category order as
|
true_sampling_proportions |
Numeric vector of length two containing the true control and case sampling proportions, in that order. |
phenotype_misclassification_matrix |
Numeric two-by-two matrix whose rows are true phenotype categories (control, case) and whose columns are observed phenotype categories (control, case). |
genotype_misclassification_matrix |
Numeric square matrix whose rows are true genotype categories and whose columns are observed genotype categories, in the genotype-frequency order. |
n_fallible |
Number sampled with fallible phenotype and genotype measurements only. |
n_pheno_validated |
Number whose phenotype is validated while genotype is measured fallibly. |
n_geno_validated |
Number whose genotype is validated while phenotype is measured fallibly. |
n_both_validated |
Number whose phenotype and genotype are both validated. |
A single nonnegative numeric value: the LRTae NCP.
Ji, F., Yang, Y., Haynes, C., Finch, S. J., & Gordon, D. (2005). Computing asymptotic power and sample size for case-control genetic association studies in the presence of phenotype and/or genotype misclassification errors. Statistical Applications in Genetics and Molecular Biology, 4(1), Article 37. doi:10.2202/1544-6115.1184
Barral, S., Haynes, C., Stone, M., & Gordon, D. (2006). LRTae: improving statistical power for genetic association with case/control data when phenotype and/or genotype misclassification errors are present. BMC Genetics, 7, 24. doi:10.1186/1471-2156-7-24
Gordon, D., Finch, S. J., & Kim, W. (2020). Heterogeneity in Statistical Genetics: How to Assess, Address, and Account for Mixtures in Association Studies. Springer. doi:10.1007/978-3-030-61121-7
lrtae_ncp( true_control_genotype_frequencies = c(0.81, 0.18, 0.01), true_case_genotype_frequencies = c(0.64, 0.32, 0.04), true_sampling_proportions = c(0.5, 0.5), phenotype_misclassification_matrix = matrix( c(0.95, 0.05, 0.05, 0.95), nrow = 2, byrow = TRUE ), genotype_misclassification_matrix = matrix( c(0.950, 0.050, 0.000, 0.025, 0.950, 0.025, 0.000, 0.050, 0.950), nrow = 3, byrow = TRUE ), n_fallible = 700, n_pheno_validated = 100, n_geno_validated = 100, n_both_validated = 100 )lrtae_ncp( true_control_genotype_frequencies = c(0.81, 0.18, 0.01), true_case_genotype_frequencies = c(0.64, 0.32, 0.04), true_sampling_proportions = c(0.5, 0.5), phenotype_misclassification_matrix = matrix( c(0.95, 0.05, 0.05, 0.95), nrow = 2, byrow = TRUE ), genotype_misclassification_matrix = matrix( c(0.950, 0.050, 0.000, 0.025, 0.950, 0.025, 0.000, 0.050, 0.950), nrow = 3, byrow = TRUE ), n_fallible = 700, n_pheno_validated = 100, n_geno_validated = 100, n_both_validated = 100 )
Computes prospective power for the likelihood-ratio test allowing for error
(LRTae). The function uses lrtae_ncp() and the corrected LRTae information
matrix; it does not perform an observed-data hypothesis test.
lrtae_power( true_control_genotype_frequencies, true_case_genotype_frequencies, true_sampling_proportions, phenotype_misclassification_matrix, genotype_misclassification_matrix, n_fallible, n_pheno_validated, n_geno_validated, n_both_validated, alpha )lrtae_power( true_control_genotype_frequencies, true_case_genotype_frequencies, true_sampling_proportions, phenotype_misclassification_matrix, genotype_misclassification_matrix, n_fallible, n_pheno_validated, n_geno_validated, n_both_validated, alpha )
true_control_genotype_frequencies |
Numeric vector of true genotype frequencies among controls. |
true_case_genotype_frequencies |
Numeric vector of true genotype
frequencies among cases, in the same category order as
|
true_sampling_proportions |
Numeric vector of length two containing the true control and case sampling proportions, in that order. |
phenotype_misclassification_matrix |
Numeric two-by-two matrix whose rows are true phenotype categories (control, case) and whose columns are observed phenotype categories (control, case). |
genotype_misclassification_matrix |
Numeric square matrix whose rows are true genotype categories and whose columns are observed genotype categories, in the genotype-frequency order. |
n_fallible |
Number sampled with fallible phenotype and genotype measurements only. |
n_pheno_validated |
Number whose phenotype is validated while genotype is measured fallibly. |
n_geno_validated |
Number whose genotype is validated while phenotype is measured fallibly. |
n_both_validated |
Number whose phenotype and genotype are both validated. |
alpha |
Significance level, strictly between zero and one. |
For k genotype categories, the asymptotic reference distribution
has k - 1 degrees of freedom. The rejection threshold is the upper
alpha quantile of the central chi-square distribution, and power is the
corresponding upper-tail probability from a noncentral chi-square
distribution with the NCP returned by lrtae_ncp().
An object of class lrtae_power, containing power, ncp, df,
alpha, critical_value, the four sampling-tier counts, and N_total.
lrtae_power( true_control_genotype_frequencies = c(0.81, 0.18, 0.01), true_case_genotype_frequencies = c(0.64, 0.32, 0.04), true_sampling_proportions = c(0.5, 0.5), phenotype_misclassification_matrix = matrix( c(0.95, 0.05, 0.05, 0.95), 2, byrow = TRUE ), genotype_misclassification_matrix = matrix( c(0.950, 0.050, 0.000, 0.025, 0.950, 0.025, 0.000, 0.050, 0.950), 3, byrow = TRUE ), n_fallible = 700, n_pheno_validated = 100, n_geno_validated = 100, n_both_validated = 100, alpha = 0.05 )lrtae_power( true_control_genotype_frequencies = c(0.81, 0.18, 0.01), true_case_genotype_frequencies = c(0.64, 0.32, 0.04), true_sampling_proportions = c(0.5, 0.5), phenotype_misclassification_matrix = matrix( c(0.95, 0.05, 0.05, 0.95), 2, byrow = TRUE ), genotype_misclassification_matrix = matrix( c(0.950, 0.050, 0.000, 0.025, 0.950, 0.025, 0.000, 0.050, 0.950), 3, byrow = TRUE ), n_fallible = 700, n_pheno_validated = 100, n_geno_validated = 100, n_both_validated = 100, alpha = 0.05 )
Constructs the analytic genotype transition matrix induced by fixed sequencing coverage, symmetric per-read sequencing error, and deterministic maximum-likelihood genotype calling.
ngs_genotype_error_matrix(coverage, seq_error)ngs_genotype_error_matrix(coverage, seq_error)
coverage |
A single finite integer greater than or equal to 1 giving sequencing coverage (read depth). |
seq_error |
A single finite numeric sequencing-error probability in
|
For true genotype , the alternate-read count follows
where , , and
. For every possible alternate-read count, the called
genotype maximizes its binomial likelihood among the three genotype models.
Numerical likelihood ties within 1e-12 are resolved symmetrically:
below an alternate-read fraction of one half, the lower tied genotype is
selected; above one half, the higher tied genotype is selected; at exactly
one half, the tied genotype closest to 1 is selected.
Rows correspond to true genotypes and columns to called genotypes. Thus, if
E is the returned matrix and g_true is a length-three vector of
true genotype probabilities, called-genotype probabilities are obtained as
as.numeric(t(E) %*% g_true). Every row sums to one within numerical
precision.
At finite coverage, even with zero sequencing error, a true heterozygote can produce all-reference or all-alternate reads. Consequently the finite-depth matrix need not be exactly the identity, especially at very low coverage.
A numeric 3 x 3 matrix. Rows true_0, true_1, and
true_2 identify the true genotype; columns called_0,
called_1, and called_2 identify the maximum-likelihood call.
E <- ngs_genotype_error_matrix(coverage = 10, seq_error = 0.01) g_true <- c(0.70, 0.25, 0.05) as.numeric(t(E) %*% g_true)E <- ngs_genotype_error_matrix(coverage = 10, seq_error = 0.01) g_true <- c(0.70, 0.25, 0.05) as.numeric(t(E) %*% g_true)
Creates the modular bslib dashboard for paweh study design. The
Case-Control and TDT / Family workspaces provide canonical power,
minimum-sample-size, sensitivity, and study-specific visual results. The
Quantitative Trait workspace collects the canonical function inputs and
displays that function's verbose console output. Dashboard calculations
delegate to the same canonical package functions as the programmatic R
interface.
paweh_app()paweh_app()
paweh_app() returns the application object without launching it. This makes
the app safe to construct in package code, tests, and deployment tooling.
Launch it explicitly with shiny::runApp().
A Shiny application object inheriting from shiny.appobj.
app <- paweh_app() inherits(app, "shiny.appobj") if (interactive()) { shiny::runApp(app) }app <- paweh_app() inherits(app, "shiny.appobj") if (interactive()) { shiny::runApp(app) }
Sweeps one x-axis parameter and repeatedly calls
cc_mssn() to plot the minimum sample size
necessary (MSSN) for case-control tests.
plot_cc_mssn( x_var, x_values, test = c("genotypes", "trend"), input_mode = c("model_based", "model_free"), sample_size = c("total", "case", "control"), compare_tests = FALSE, title = NULL, x_label = NULL, y_label = NULL, return_data = FALSE, ... )plot_cc_mssn( x_var, x_values, test = c("genotypes", "trend"), input_mode = c("model_based", "model_free"), sample_size = c("total", "case", "control"), compare_tests = FALSE, title = NULL, x_label = NULL, y_label = NULL, return_data = FALSE, ... )
x_var |
Character. Parameter to vary on the x-axis. |
x_values |
Numeric vector of x-axis values. |
test |
One of |
input_mode |
One of |
sample_size |
One of |
compare_tests |
Logical. If TRUE, plot genotype and trend tests
together and ignore |
title |
Optional character title override. |
x_label |
Optional x-axis label override. |
y_label |
Optional y-axis label override. |
return_data |
Logical. If TRUE, return the data frame instead of a ggplot. |
... |
Arguments passed to |
The supported test values are "genotypes" and "trend".
sample_size selects whether to plot required cases, controls, or
total sample size. compare_tests = TRUE plots both tests together.
Supported x_var values are the same heterogeneity and
misclassification variables documented for plot_cc_power(),
plus "power" for target power. Fixed sample-size variables such as
"N_case" are not valid because sample size is the MSSN output.
Multiplier behavior matches plot_cc_power():
pheno_error_multiplier multiplies baseline theta_base and
phi_base; geno_error_multiplier multiplies the corresponding
baseline genotype-error parameters for the selected genotype
misclassification model.
All arguments in ... remain fixed while x_var is swept. The
y-axis is the required number of selected cases, controls, or total
individuals returned by cc_mssn(), according to sample_size.
For locus-heterogeneity sweeps, an exact pi = 0 design has no finite
MSSN when target power exceeds alpha. That scientifically structural
boundary is retained with MSSN NA, finite_mssn = FALSE, and
status = "no finite MSSN"; other errors are propagated unchanged.
A ggplot object, or a data frame if return_data = TRUE.
plot_cc_mssn( x_var = "geno_error_multiplier", x_values = c(0, 1, 2), test = "trend", input_mode = "model_based", power = 0.80, alpha = 0.05, prev = 0.10, pd = 0.25, R2 = 2, MOI = "M", geno_misclass = "3p", e01_base = 0.02, e02_base = 0.01, e03_base = 0.005, k = 1 )plot_cc_mssn( x_var = "geno_error_multiplier", x_values = c(0, 1, 2), test = "trend", input_mode = "model_based", power = 0.80, alpha = 0.05, prev = 0.10, pd = 0.25, R2 = 2, MOI = "M", geno_misclass = "3p", e01_base = 0.02, e02_base = 0.01, e03_base = 0.005, k = 1 )
Sweeps one x-axis parameter and repeatedly calls
cc_power() to plot case-control power.
The wrapper supports both input_mode = "model_based" and
input_mode = "model_free".
plot_cc_power( x_var, x_values, test = c("genotypes", "trend"), input_mode = c("model_based", "model_free"), compare_tests = FALSE, title = NULL, x_label = NULL, y_label = NULL, return_data = FALSE, ... )plot_cc_power( x_var, x_values, test = c("genotypes", "trend"), input_mode = c("model_based", "model_free"), compare_tests = FALSE, title = NULL, x_label = NULL, y_label = NULL, return_data = FALSE, ... )
x_var |
Character. Parameter to vary on the x-axis. |
x_values |
Numeric vector of x-axis values. |
test |
One of |
input_mode |
One of |
compare_tests |
Logical. If TRUE, plot genotype and trend tests
together and ignore |
title |
Optional character title override. |
x_label |
Optional x-axis label override. |
y_label |
Optional y-axis label override. |
return_data |
Logical. If TRUE, return the data frame instead of a ggplot. |
... |
Arguments passed to |
Supported x_var values include fixed sample-size variables
"N_case", "N_ctrl", and "N_total"; model and design
variables "alpha", "prev", "pd", "R2", and
"k"; locus-heterogeneity variables "pi" and
"locus_het_rate"; phenotype-misclassification variables
"theta", "phi", and "pheno_error_multiplier"; and
genotype-misclassification variables "e", "e1", "e2",
"e01", "e02", "e03", case/control differential
three-parameter error rates, "geno_error_multiplier", and
"diff_multiplier".
When x_var = "pheno_error_multiplier", baseline phenotype-error
values are read from theta_base and phi_base, falling back to
theta and phi if the baseline arguments are not supplied. When
x_var = "geno_error_multiplier", baseline genotype-error values are
read from e_base; e1_base and e2_base; e01_base,
e02_base, and e03_base; or case/control baseline parameters
for geno_misclass = "diff3p".
All arguments supplied through ... remain fixed while
x_var is swept. The x-axis contains x_values; the y-axis is
the power returned by cc_power() for the selected genotype chi-square
or trend test. With compare_tests = TRUE, both powers are drawn on
the same axes.
When sweeping x_var = "pi", set locus_het = TRUE. The exact
pi = 0 null boundary is retained in returned and plotted data with
zero NCP and power equal to alpha.
A ggplot object, or a data frame if return_data = TRUE.
g_aff <- c((1 - 0.05)^2, 2 * 0.05 * (1 - 0.05), 0.05^2) g_unaff <- c((1 - 0.15)^2, 2 * 0.15 * (1 - 0.15), 0.15^2) plot_cc_power( x_var = "phi", x_values = c(0, 0.02, 0.04), test = "genotypes", input_mode = "model_free", N_case = 250, alpha = 0.01, g1 = g_aff, g0 = g_unaff, prev = 0.05, pheno_misclass = TRUE, theta = 0, k = 1 )g_aff <- c((1 - 0.05)^2, 2 * 0.05 * (1 - 0.05), 0.05^2) g_unaff <- c((1 - 0.15)^2, 2 * 0.15 * (1 - 0.15), 0.15^2) plot_cc_power( x_var = "phi", x_values = c(0, 0.02, 0.04), test = "genotypes", input_mode = "model_free", N_case = 250, alpha = 0.01, g1 = g_aff, g0 = g_unaff, prev = 0.05, pheno_misclass = TRUE, theta = 0, k = 1 )
Plots analytic minimum sample size necessary (MSSN) against equal fixed sequencing coverage for either a case-control sequencing trend design or a TDT1-NGS design. Calculations delegate to the corresponding public MSSN API.
plot_ngs_mssn( design = c("cc", "tdt"), coverage, seq_error, return_data = FALSE, ... )plot_ngs_mssn( design = c("cc", "tdt"), coverage, seq_error, return_data = FALSE, ... )
design |
Either |
coverage |
Non-empty numeric vector of integer fixed sequencing depths. TDT1-NGS requires coverage of at least 2. |
seq_error |
Non-empty numeric vector of symmetric per-read sequencing
error probabilities in |
return_data |
Logical. If |
... |
Fixed arguments passed to |
The primary case-control y-axis is required cases; returned plot data also retain required controls, total MSSN, and achieved power. The primary TDT1-NGS y-axis is required complete trios; returned data also retain total individuals and achieved power.
At the case-control exact-null boundary pi = 0, no finite MSSN exists
when requested power exceeds alpha. The row is retained with MSSN and
achieved power set to NA, finite_mssn = FALSE, and status
"no finite MSSN". No artificial finite value is plotted. Only this
expected scientific condition is converted; invalid inputs and unexpected
calculation errors propagate unchanged.
Coverage is fixed and equal for the relevant study members. These plots do not model variable/BGE coverage distributions, cost optimization, or sample-specific depth. They use no simulation.
A ggplot object with exact results in plot$data, or a data
frame when return_data = TRUE.
plot_ngs_power, cc_ngs_mssn,
tdt_ngs_mssn
plot_ngs_mssn( design = "tdt", coverage = c(4, 12, 20), seq_error = 0.005, power = 0.80, pd = 0.325, R1 = 1.2, alpha = 5e-8, verbose = FALSE )plot_ngs_mssn( design = "tdt", coverage = c(4, 12, 20), seq_error = 0.005, power = 0.80, pd = 0.325, R1 = 1.2, alpha = 5e-8, verbose = FALSE )
Plots prospective analytic power against equal fixed sequencing coverage for either a case-control sequencing trend design or a TDT1-NGS design. Exact values are obtained by repeated calls to the corresponding validated public design function.
plot_ngs_power( design = c("cc", "tdt"), coverage, seq_error, target_power = NULL, return_data = FALSE, ... )plot_ngs_power( design = c("cc", "tdt"), coverage, seq_error, target_power = NULL, return_data = FALSE, ... )
design |
Either |
coverage |
Non-empty numeric vector of integer fixed sequencing depths. TDT1-NGS requires coverage of at least 2. |
seq_error |
Non-empty numeric vector of symmetric per-read sequencing
error probabilities in |
target_power |
Optional finite scalar in |
return_data |
Logical. If |
... |
Fixed arguments passed to |
Case-control output retains coverage, sequencing error, locus-homogeneity
fraction, sample sizes, NCP, and power. At pi = 0, the exact null
point is retained with NCP zero and power equal to alpha. TDT1-NGS uses raw
read-count probabilities and does not use the case-control hard-call model.
Coverage is fixed and equal for the relevant study members. These plots do not model variable/BGE coverage distributions, cost optimization, or sample-specific depth. They introduce no simulation and delegate all statistical calculations to public PAWEH sequencing design APIs.
A ggplot object with exact results in plot$data, or a data
frame when return_data = TRUE.
plot_ngs_mssn, cc_ngs_power,
tdt_ngs_power
plot_ngs_power( design = "cc", coverage = c(4, 12, 20), seq_error = c(0, 0.01), N_case = 1000, alpha = 0.05, prev = 0.05, pd = 0.30, R2 = 1.8, MOI = "M", verbose = FALSE )plot_ngs_power( design = "cc", coverage = c(4, 12, 20), seq_error = c(0, 0.01), N_case = 1000, alpha = 0.05, prev = 0.05, pd = 0.30, R2 = 1.8, MOI = "M", verbose = FALSE )
Sweeps one model or design parameter and repeatedly calls
qtl_anova_mssn().
plot_qtl_anova_mssn( x_var, x_values, title = NULL, x_label = NULL, y_label = NULL, return_data = FALSE, ... )plot_qtl_anova_mssn( x_var, x_values, title = NULL, x_label = NULL, y_label = NULL, return_data = FALSE, ... )
x_var |
Parameter to vary. One of |
x_values |
Numeric vector of at least two finite x-axis values. |
title |
Optional plot-title override. |
x_label |
Optional x-axis-label override. |
y_label |
Optional y-axis-label override. |
return_data |
Logical. If |
... |
Fixed arguments passed to |
The x-axis is x_values for the selected x_var; the
y-axis is the minimum total sample size returned by qtl_anova_mssn().
Target power and other arguments in ... remain fixed unless selected
as x_var.
A ggplot object, or a data frame with the swept parameter and
required_N if return_data = TRUE.
qtl_anova_mssn,
plot_qtl_anova_power.
plot_qtl_anova_mssn( x_var = "qtl_var", x_values = c(0.015, 0.025, 0.05), power = 0.8, alpha = 0.0001, tau = 0.5, pd = 0.15 )plot_qtl_anova_mssn( x_var = "qtl_var", x_values = c(0.015, 0.025, 0.05), power = 0.8, alpha = 0.0001, tau = 0.5, pd = 0.15 )
Sweeps one model or design parameter and repeatedly calls
qtl_anova_power() for a single continuous quantitative trait.
plot_qtl_anova_power( x_var, x_values, title = NULL, x_label = NULL, y_label = NULL, return_data = FALSE, ... )plot_qtl_anova_power( x_var, x_values, title = NULL, x_label = NULL, y_label = NULL, return_data = FALSE, ... )
x_var |
Parameter to vary. One of |
x_values |
Numeric vector of at least two finite x-axis values. |
title |
Optional plot-title override. |
x_label |
Optional x-axis-label override. |
y_label |
Optional y-axis-label override. |
return_data |
Logical. If |
... |
Fixed arguments passed to |
The x-axis is x_values for the selected x_var; the
y-axis is one-way ANOVA power from qtl_anova_power(). Every argument
in ... remains fixed while the selected parameter is swept.
A ggplot object, or a data frame with the swept parameter and power
if return_data = TRUE.
qtl_anova_power,
plot_qtl_anova_mssn.
plot_qtl_anova_power( x_var = "N", x_values = c(600, 800, 1000), alpha = 0.0001, qtl_var = 0.025, tau = 0.5, pd = 0.15 )plot_qtl_anova_power( x_var = "N", x_values = c(600, 800, 1000), alpha = 0.0001, qtl_var = 0.025, tau = 0.5, pd = 0.15 )
Displays the three normal quantitative-trait distributions implied by a validated single-trait Falconer model. Large QTL variance separates the genotype distributions relative to their residual variation; small QTL variance makes them overlap heavily.
plot_qtl_genotype_distribution( qtl_var, tau, pd, type = c("density", "histogram", "binned"), scale = c("density", "frequency"), n = 3000, seed = NULL, show_means = TRUE, verbose = FALSE, title = NULL, return_data = FALSE, bins = 30L )plot_qtl_genotype_distribution( qtl_var, tau, pd, type = c("density", "histogram", "binned"), scale = c("density", "frequency"), n = 3000, seed = NULL, show_means = TRUE, verbose = FALSE, title = NULL, return_data = FALSE, bins = 30L )
qtl_var |
QTL variance in |
tau |
Dominance-to-additivity ratio. |
pd |
Increaser-allele frequency in |
type |
One of |
scale |
Either |
n |
Total population size simulated in histogram mode. |
seed |
Optional non-negative integer used locally for reproducible histogram simulation. The caller's random-number state is restored. |
show_means |
Logical; mark the three theoretical genotype means. |
verbose |
Logical; passed to the validated Falconer parameter backend. |
title |
Optional plot title. |
return_data |
Logical; return the plotting data frame instead of the
ggplot object. The Falconer model is retained in its |
bins |
Positive integer number of equal-width bins used when
|
Conditional on genotype j, the plotted trait follows a normal
distribution with the corresponding Falconer mean and common residual
variance 1 - qtl_var. Genotypes 0, 1, and 2 have Hardy–Weinberg
frequencies (1 - pd)^2, 2 * pd * (1 - pd), and pd^2. Genotypes may
also be interpreted as bb, Bb, and BB, respectively.
Density and binned modes are analytic and perform no simulation. In binned
mode, each conditional bin probability is the difference between Normal CDF
values at the upper and lower bin boundaries. Histogram mode first samples
genotypes from their Hardy–Weinberg frequencies and then samples trait
values from the corresponding conditional normal distributions.
The x-axis is the quantitative-trait value. In analytic density mode, the
y-axis is genotype-specific density when scale = "density" and
population-weighted density when scale = "frequency". Binned mode uses
conditional bin probability divided by bin width, with an additional
genotype-frequency multiplier under scale = "frequency". In simulated
histogram mode, the y-axis is normalized density or bin count for those
respective scales.
A ggplot object, or a plotting data frame when
return_data = TRUE.
qtl_falconer_parameters(), plot_qtl_anova_power(), and
plot_qtl_threshold_chisq_power().
# A large QTL effect visibly separates the genotype distributions. plot_qtl_genotype_distribution( qtl_var = 0.5, tau = 0, pd = 0.25, scale = "frequency" ) # A very small QTL effect produces almost complete overlap. plot_qtl_genotype_distribution( qtl_var = 0.0005, tau = 0, pd = 0.25, scale = "frequency" )# A large QTL effect visibly separates the genotype distributions. plot_qtl_genotype_distribution( qtl_var = 0.5, tau = 0, pd = 0.25, scale = "frequency" ) # A very small QTL effect produces almost complete overlap. plot_qtl_genotype_distribution( qtl_var = 0.0005, tau = 0, pd = 0.25, scale = "frequency" )
Sweeps one model, selection, or design parameter and repeatedly calls
qtl_threshold_chisq_mssn().
plot_qtl_threshold_chisq_mssn( x_var, x_values, sample_size = c("total", "case", "control"), title = NULL, x_label = NULL, y_label = NULL, return_data = FALSE, ... )plot_qtl_threshold_chisq_mssn( x_var, x_values, sample_size = c("total", "case", "control"), title = NULL, x_label = NULL, y_label = NULL, return_data = FALSE, ... )
x_var |
Parameter to vary. One of |
x_values |
Numeric vector of at least two finite x-axis values. |
sample_size |
Selected-sample result to plot: |
title |
Optional plot-title override. |
x_label |
Optional x-axis-label override. |
y_label |
Optional y-axis-label override. |
return_data |
Logical. If |
... |
Fixed arguments passed to |
The x-axis is x_values for the selected model, selection,
or design parameter. The y-axis is the selected case, control, or total MSSN
requested by sample_size; it is not a source-population screening
count. Other arguments remain fixed while x_var is swept.
A ggplot object, or a data frame with the swept parameter and the
selected MSSN result if return_data = TRUE.
qtl_threshold_chisq_mssn,
plot_qtl_threshold_chisq_power.
plot_qtl_threshold_chisq_mssn( x_var = "qtl_var", x_values = c(0.015, 0.025, 0.05), power = 0.8, alpha = 0.0001, tau = 0.5, pd = 0.15, x_upper = 5, x_lower = 5, k = 1 )plot_qtl_threshold_chisq_mssn( x_var = "qtl_var", x_values = c(0.015, 0.025, 0.05), power = 0.8, alpha = 0.0001, tau = 0.5, pd = 0.15, x_upper = 5, x_lower = 5, k = 1 )
Sweeps one model, selection, or design parameter and repeatedly calls
qtl_threshold_chisq_power().
plot_qtl_threshold_chisq_power( x_var, x_values, title = NULL, x_label = NULL, y_label = NULL, return_data = FALSE, ... )plot_qtl_threshold_chisq_power( x_var, x_values, title = NULL, x_label = NULL, y_label = NULL, return_data = FALSE, ... )
x_var |
Parameter to vary. One of |
x_values |
Numeric vector of at least two finite x-axis values. |
title |
Optional plot-title override. |
x_label |
Optional x-axis-label override. |
y_label |
Optional y-axis-label override. |
return_data |
Logical. If |
... |
Fixed arguments passed to |
The x-axis is x_values for the selected model, selection,
or design parameter. The y-axis is power for the two-df genotype chi-square
test after upper-tail case and lower-tail control selection. Arguments in
... remain fixed while x_var is swept.
A ggplot object, or a data frame with the swept parameter and power
if return_data = TRUE.
qtl_threshold_chisq_power,
plot_qtl_threshold_chisq_mssn.
plot_qtl_threshold_chisq_power( x_var = "N_case", x_values = c(75, 100, 125, 150), alpha = 0.0001, qtl_var = 0.025, tau = 0.5, pd = 0.15, x_upper = 5, x_lower = 5, k = 1 )plot_qtl_threshold_chisq_power( x_var = "N_case", x_values = c(75, 100, 125, 150), alpha = 0.0001, qtl_var = 0.025, tau = 0.5, pd = 0.15, x_upper = 5, x_lower = 5, k = 1 )
Sweeps one x-axis parameter and repeatedly calls
tdt_mssn() to plot MSSN in affected trios. The wrapper
supports both input_mode = "model_based" and
input_mode = "model_free".
plot_tdt_mssn( x_var, x_values, scenario = c("auto", "no_error", "misclassification", "heterogeneity"), input_mode = c("model_based", "model_free"), title = NULL, x_label = NULL, y_label = NULL, return_data = FALSE, ... )plot_tdt_mssn( x_var, x_values, scenario = c("auto", "no_error", "misclassification", "heterogeneity"), input_mode = c("model_based", "model_free"), title = NULL, x_label = NULL, y_label = NULL, return_data = FALSE, ... )
x_var |
Character. Parameter to vary on the x-axis. |
x_values |
Numeric vector of x-axis values. |
scenario |
One of |
input_mode |
One of |
title |
Optional character title override. |
x_label |
Optional x-axis label override. |
y_label |
Optional y-axis label override. |
return_data |
Logical. If TRUE, return the data frame instead of a ggplot. |
... |
Arguments passed to |
scenario selects the component of the canonical TDT backend
output: "no_error", "misclassification", or
"heterogeneity". With scenario = "auto", the wrapper chooses
the scenario from x_var using the same rules as
plot_tdt_power(). This wrapper does not include a
compare-scenarios mode. x_var = "N" is not allowed because required
trios are the output; use "target_power" to sweep target power.
With input_mode = "model_based" (the default), this wrapper's
x_var choices and output are numerically identical to sweeping
tdt_mssn() directly. "pd",
"prev", "R1", "R2", and "delta_prime" are only
valid x_var choices in this mode.
With input_mode = "model_free", sweep "ET", "ENT", or
"n_trios" instead (or any of the shared "misclass_rate",
"heter_rate", "locus_het_rate", or
"pheno_error_multiplier" variables). A resolved scenario =
"heterogeneity" requires a fixed pd argument, and scenario =
"misclassification" requires fixed pd and prev arguments,
because the conditional backend needs them to apply
heter_rate/misclass_rate to the supplied ET/ENT.
Unlike tdt_mssn()'s own default of
0.01, heter_rate and misclass_rate default to
0 here in input_mode = "model_free" (unless fixed via
... or swept via x_var), so scenario = "no_error"
always works without pd/prev.
All arguments passed through ... remain fixed while x_var
is swept. The y-axis is MSSN expressed as the required number of affected
trios for the resolved scenario. When x_var = "heter_rate", it is
the heterogeneous trio fraction ; target_power remains
fixed unless it is itself the swept variable.
A ggplot object, or a data frame if return_data = TRUE.
tdt_mssn, plot_tdt_power,
plot_tdt_mssn_phenotype_misclassification, and
plot_tdt_mssn_locus_heterogeneity.
plot_tdt_mssn( x_var = "misclass_rate", x_values = c(0, 0.02, 0.04), scenario = "misclassification", input_mode = "model_based", target_power = 0.80, pd = 0.30, prev = 0.05, R1 = 1.5, R2 = 2.25, alpha = 0.05, delta_prime = 1 )plot_tdt_mssn( x_var = "misclass_rate", x_values = c(0, 0.02, 0.04), scenario = "misclassification", input_mode = "model_based", target_power = 0.80, pd = 0.30, prev = 0.05, R1 = 1.5, R2 = 2.25, alpha = 0.05, delta_prime = 1 )
Plot required number of trios vs heterogeneity rate (1 - pi), holding misclassification fixed.
plot_tdt_mssn_locus_heterogeneity( pd, prev, R1, R2, alpha = 0.05, delta_prime = 1, target_power, heter_seq = seq(0, 0.5, by = 0.05), misclass_fixed = 0, title = "Required trios vs heterogeneity (1 - pi)" )plot_tdt_mssn_locus_heterogeneity( pd, prev, R1, R2, alpha = 0.05, delta_prime = 1, target_power, heter_seq = seq(0, 0.5, by = 0.05), misclass_fixed = 0, title = "Required trios vs heterogeneity (1 - pi)" )
pd |
Disease allele frequency. |
prev |
Disease prevalence. |
R1 |
Genotype relative risk for heterozygotes. |
R2 |
Genotype relative risk for risk homozygotes. |
alpha |
Significance level. |
delta_prime |
Linkage disequilibrium scaling parameter. |
target_power |
Desired statistical power. |
heter_seq |
Numeric vector. Sequence of heterogeneity rates. |
misclass_fixed |
Numeric. Misclassification rate held fixed (default 0). (Other params same meaning as in plot_tdt_power_phenotype_misclassification.) |
title |
Plot title. |
The x-axis is the heterogeneous trio fraction ; the
homogeneous/linked fraction is . The y-axis is MSSN, the required
number of affected trios returned by tdt_mssn() for fixed
target_power. misclass_fixed and genetic-model parameters
remain fixed.
A ggplot object, returned invisibly after it is printed.
tdt_mssn,
plot_tdt_mssn_phenotype_misclassification, and
plot_tdt_mssn.
# Required sample size sensitivity to locus heterogeneity plot_tdt_mssn_locus_heterogeneity( target_power = 0.80, pd = 0.30, prev = 0.05, R1 = 1.5, R2 = 2.25, heter_seq = c(0, 0.1, 0.2), misclass_fixed = 0 )# Required sample size sensitivity to locus heterogeneity plot_tdt_mssn_locus_heterogeneity( target_power = 0.80, pd = 0.30, prev = 0.05, R1 = 1.5, R2 = 2.25, heter_seq = c(0, 0.1, 0.2), misclass_fixed = 0 )
Plot required number of trios vs misclassification rate (pi01), holding heterogeneity fixed.
plot_tdt_mssn_phenotype_misclassification( pd, prev, R1, R2, alpha = 0.05, delta_prime = 1, target_power, misclass_seq = seq(0, 0.15, by = 0.01), heter_fixed = 0, title = "Required trios vs misclassification (pi01)" )plot_tdt_mssn_phenotype_misclassification( pd, prev, R1, R2, alpha = 0.05, delta_prime = 1, target_power, misclass_seq = seq(0, 0.15, by = 0.01), heter_fixed = 0, title = "Required trios vs misclassification (pi01)" )
pd |
Disease allele frequency. |
prev |
Disease prevalence. |
R1 |
Genotype relative risk for heterozygotes. |
R2 |
Genotype relative risk for risk homozygotes. |
alpha |
Significance level. |
delta_prime |
Linkage disequilibrium scaling parameter. |
target_power |
Numeric. Desired power for sample size calculation. |
misclass_seq |
Numeric vector. Sequence of misclassification rates. |
heter_fixed |
Numeric. Heterogeneity rate held fixed (default 0). (Other params same meaning as in plot_tdt_power_phenotype_misclassification.) |
title |
Plot title. |
The x-axis is phenotype misclassification probability
. The y-axis is MSSN, the required number of affected trios
returned by tdt_mssn() for fixed target_power.
heter_fixed and all genetic-model parameters remain fixed.
A ggplot object, returned invisibly after it is printed.
tdt_mssn,
plot_tdt_mssn_locus_heterogeneity, and
plot_tdt_mssn.
# Required sample size sensitivity to phenotype misclassification plot_tdt_mssn_phenotype_misclassification( target_power = 0.80, pd = 0.30, prev = 0.05, R1 = 1.5, R2 = 2.25, misclass_seq = c(0, 0.03, 0.06), heter_fixed = 0 )# Required sample size sensitivity to phenotype misclassification plot_tdt_mssn_phenotype_misclassification( target_power = 0.80, pd = 0.30, prev = 0.05, R1 = 1.5, R2 = 2.25, misclass_seq = c(0, 0.03, 0.06), heter_fixed = 0 )
Sweeps one x-axis parameter and repeatedly calls
tdt_power() to plot Transmission
Disequilibrium Test (TDT) power. The wrapper supports both
input_mode = "model_based" and input_mode = "model_free".
plot_tdt_power( x_var, x_values, scenario = c("auto", "no_error", "misclassification", "heterogeneity"), input_mode = c("model_based", "model_free"), title = NULL, x_label = NULL, y_label = NULL, return_data = FALSE, ... )plot_tdt_power( x_var, x_values, scenario = c("auto", "no_error", "misclassification", "heterogeneity"), input_mode = c("model_based", "model_free"), title = NULL, x_label = NULL, y_label = NULL, return_data = FALSE, ... )
x_var |
Character. Parameter to vary on the x-axis. |
x_values |
Numeric vector of x-axis values. |
scenario |
One of |
input_mode |
One of |
title |
Optional character title override. |
x_label |
Optional x-axis label override. |
y_label |
Optional y-axis label override. |
return_data |
Logical. If TRUE, return the data frame instead of a ggplot. |
... |
Arguments passed to |
scenario selects the component of the canonical TDT backend
output: "no_error", "misclassification", or
"heterogeneity". With scenario = "auto", the wrapper chooses
misclassification for x_var = "misclass_rate" or
"pheno_error_multiplier", heterogeneity for x_var =
"heter_rate" or "locus_het_rate", and no error otherwise. This
wrapper does not include a compare-scenarios mode.
With input_mode = "model_based" (the default), this wrapper's
x_var choices and output are numerically identical to sweeping
tdt_power() directly. "pd", "prev",
"R1", "R2", and "delta_prime" are only valid
x_var choices in this mode.
With input_mode = "model_free", sweep "ET" or "ENT"
instead (or any of the shared "misclass_rate", "heter_rate",
"locus_het_rate", or "pheno_error_multiplier" variables). A
resolved scenario = "heterogeneity" requires a fixed pd
argument, and scenario = "misclassification" requires fixed
pd and prev arguments, because the conditional backend needs
them to apply heter_rate/misclass_rate to the supplied
ET/ENT. Unlike tdt_power()'s
own default of 0.01, heter_rate and misclass_rate
default to 0 here in input_mode = "model_free" (unless fixed
via ... or swept via x_var), so scenario = "no_error"
always works without pd/prev.
All arguments passed through ... remain fixed while x_var
is swept. The x-axis contains x_values; the y-axis is TDT power for
the resolved scenario. When x_var = "heter_rate", the axis is the
heterogeneous trio fraction .
A ggplot object, or a data frame if return_data = TRUE.
tdt_power, plot_tdt_mssn,
plot_tdt_power_phenotype_misclassification, and
plot_tdt_power_locus_heterogeneity.
plot_tdt_power( x_var = "heter_rate", x_values = c(0, 0.1, 0.2), scenario = "heterogeneity", input_mode = "model_based", N = 600, pd = 0.30, prev = 0.05, R1 = 1.5, R2 = 2.25, alpha = 0.05, delta_prime = 1 )plot_tdt_power( x_var = "heter_rate", x_values = c(0, 0.1, 0.2), scenario = "heterogeneity", input_mode = "model_based", N = 600, pd = 0.30, prev = 0.05, R1 = 1.5, R2 = 2.25, alpha = 0.05, delta_prime = 1 )
Plot TDT power vs locus heterogeneity rate (1 - pi), holding misclassification fixed.
plot_tdt_power_locus_heterogeneity( pd, prev, R1, R2, alpha = 0.05, delta_prime = 1, N, heter_seq = seq(0, 0.5, by = 0.05), misclass_fixed = 0, title = "TDT power vs heterogeneity (1 - pi)" )plot_tdt_power_locus_heterogeneity( pd, prev, R1, R2, alpha = 0.05, delta_prime = 1, N, heter_seq = seq(0, 0.5, by = 0.05), misclass_fixed = 0, title = "TDT power vs heterogeneity (1 - pi)" )
pd |
Disease allele frequency. |
prev |
Disease prevalence. |
R1 |
Genotype relative risk for heterozygotes. |
R2 |
Genotype relative risk for risk homozygotes. |
alpha |
Significance level. |
delta_prime |
Linkage disequilibrium scaling parameter. |
N |
Number of affected trios. |
heter_seq |
Numeric vector. Sequence of heterogeneity rates. |
misclass_fixed |
Numeric. Misclassification rate held fixed (default 0). (Other params same meaning as in plot_tdt_power_phenotype_misclassification.) |
title |
Plot title. |
The x-axis is the heterogeneous trio fraction ; the
homogeneous/linked fraction is . The y-axis is heterogeneity-scenario
power from tdt_power(). N, misclass_fixed, and all
genetic-model parameters remain fixed while heter_seq is swept.
A ggplot object, returned invisibly after it is printed.
tdt_power,
plot_tdt_power_phenotype_misclassification, and
plot_tdt_power.
# Power sensitivity to locus heterogeneity plot_tdt_power_locus_heterogeneity( N = 600, pd = 0.30, prev = 0.05, R1 = 1.5, R2 = 2.25, heter_seq = c(0, 0.1, 0.2), misclass_fixed = 0 )# Power sensitivity to locus heterogeneity plot_tdt_power_locus_heterogeneity( N = 600, pd = 0.30, prev = 0.05, R1 = 1.5, R2 = 2.25, heter_seq = c(0, 0.1, 0.2), misclass_fixed = 0 )
Plot TDT power vs phenotype misclassification rate (pi01), holding heterogeneity fixed.
plot_tdt_power_phenotype_misclassification( pd, prev, R1, R2, alpha = 0.05, delta_prime = 1, N, misclass_seq = seq(0, 0.15, by = 0.01), heter_fixed = 0, title = "TDT power vs misclassification (pi01)" )plot_tdt_power_phenotype_misclassification( pd, prev, R1, R2, alpha = 0.05, delta_prime = 1, N, misclass_seq = seq(0, 0.15, by = 0.01), heter_fixed = 0, title = "TDT power vs misclassification (pi01)" )
pd |
Numeric in (0,1). High-risk allele frequency at the marker. |
prev |
Numeric in (0,1). Disease prevalence (phi1). |
R1, R2
|
Numeric. Genotype relative risks. |
alpha |
Numeric. Significance level (default 0.05). |
delta_prime |
Numeric. LD scale parameter (default 1). |
N |
Integer. Number of affected trios. |
misclass_seq |
Numeric vector. Sequence of misclassification rates. |
heter_fixed |
Numeric. Heterogeneity rate held fixed (default 0). |
title |
Character. Plot title. |
The x-axis is phenotype misclassification probability
and the y-axis is the corresponding power from
tdt_power(). N is a fixed number of affected trios;
heter_fixed and all genetic-model parameters remain fixed while
misclass_seq is swept.
A ggplot object, returned invisibly after it is printed.
tdt_power,
plot_tdt_power_locus_heterogeneity, and
plot_tdt_power.
# Power sensitivity to phenotype misclassification plot_tdt_power_phenotype_misclassification( N = 600, pd = 0.30, prev = 0.05, R1 = 1.5, R2 = 2.25, misclass_seq = c(0, 0.03, 0.06), heter_fixed = 0 )# Power sensitivity to phenotype misclassification plot_tdt_power_phenotype_misclassification( N = 600, pd = 0.30, prev = 0.05, R1 = 1.5, R2 = 2.25, misclass_seq = c(0, 0.03, 0.06), heter_fixed = 0 )
Builds an interactive sensitivity surface for model-based TDT power or
minimum sample size. Any two supported model parameters can be swept while
the remaining parameters are held fixed. Every grid point is evaluated by
the canonical tdt_power() or tdt_mssn() backend.
plot_tdt_surface3d( metric = c("power", "mssn"), scenario = c("misclassification", "heterogeneity", "no_error"), x = "pd", y = "misclass_rate", x_values = NULL, y_values = NULL, N = 600, target_power = 0.8, pd = 0.3, prev = 0.05, R1 = 1.5, R2 = 2.25, alpha = 0.05, delta_prime = 1, misclass_rate = 0.01, heter_rate = 0.1, ceiling_N = TRUE, title = NULL )plot_tdt_surface3d( metric = c("power", "mssn"), scenario = c("misclassification", "heterogeneity", "no_error"), x = "pd", y = "misclass_rate", x_values = NULL, y_values = NULL, N = 600, target_power = 0.8, pd = 0.3, prev = 0.05, R1 = 1.5, R2 = 2.25, alpha = 0.05, delta_prime = 1, misclass_rate = 0.01, heter_rate = 0.1, ceiling_N = TRUE, title = NULL )
metric |
Character. Surface height: |
scenario |
Character. One of |
x, y
|
Character scalars naming two distinct swept parameters. Supported
axes are |
x_values, y_values
|
Numeric grid values for |
N |
Numeric scalar greater than zero. Number of affected trios, used
when |
target_power |
Numeric scalar in |
pd |
Numeric in |
prev |
Numeric in |
R1, R2
|
Positive numeric scalars. Fixed genotype relative risks when they are not axes. |
alpha |
Numeric in |
delta_prime |
Numeric in |
misclass_rate |
Numeric in |
heter_rate |
Numeric in |
ceiling_N |
Logical scalar. For MSSN surfaces, whether to plot the
integer ceiling of the canonical sample-size result (default |
title |
Optional character scalar. If |
The supported axes and their default grids are:
pd = seq(0.10, 0.50, length.out = 20),
prev = seq(0.01, 0.10, length.out = 20),
R1 = seq(1.1, 2, length.out = 20),
R2 = seq(1.2, 3, length.out = 20),
alpha = seq(0.01, 0.10, length.out = 20),
delta_prime = seq(0.25, 1, length.out = 20),
misclass_rate = seq(0, 0.20, length.out = 20), and
heter_rate = seq(0, 0.50, length.out = 20).
The package's implemented LD convention is
D = delta_prime * pd * (1 - pd), where delta_prime is the proportion of
maximum positive disequilibrium: 0 represents linkage equilibrium and 1
represents maximum positive LD under the model assumptions. Negative LD
would require a different, allele-frequency-dependent normalization and is
not represented by this parameterization.
The surface is deliberately model-based. N and target_power define the
design calculation and therefore remain fixed rather than becoming axes.
The model-free inputs ET, ENT, and n_trios, as well as nonnumeric
controls such as verbose, are outside this visualization interface.
MSSN is measured in affected-child trios. heter_rate is the heterogeneous
fraction, 1 - pi.
The canonical TDT backends report separate scenarios, not a combined-error
scenario. Consequently, misclass_rate is an active axis only for
scenario = "misclassification", and heter_rate is active only for
scenario = "heterogeneity". An inactive modifier axis is rejected rather
than silently producing a flat, misleading surface.
This function requires the optional plotly package. The plotting layer
introduces no independent statistical approximation: it only constructs the
grid, delegates calculations to tdt_power() or tdt_mssn(), extracts the
selected scenario, and renders the result.
An object inheriting from "plotly" and "htmlwidget". The
Cartesian grid is attached as attr(x, "surface_data"), with dynamically
named axis columns, metric_value (the plotted height), and
raw_metric_value. The plotted z matrix is attached as
attr(x, "surface_matrix"), and calculation settings as
attr(x, "surface_spec").
tdt_power(), tdt_mssn(), plot_tdt_power(),
plot_tdt_mssn()
if (requireNamespace("plotly", quietly = TRUE)) { power_surface <- plot_tdt_surface3d( metric = "power", scenario = "misclassification", x = "pd", y = "misclass_rate", x_values = c(0.2, 0.3, 0.4), y_values = c(0, 0.03, 0.06), N = 600 ) mssn_surface <- plot_tdt_surface3d( metric = "mssn", scenario = "heterogeneity", x = "prev", y = "heter_rate", x_values = c(0.02, 0.05, 0.08), y_values = c(0, 0.1, 0.2), target_power = 0.8 ) }if (requireNamespace("plotly", quietly = TRUE)) { power_surface <- plot_tdt_surface3d( metric = "power", scenario = "misclassification", x = "pd", y = "misclass_rate", x_values = c(0.2, 0.3, 0.4), y_values = c(0, 0.03, 0.06), N = 600 ) mssn_surface <- plot_tdt_surface3d( metric = "mssn", scenario = "heterogeneity", x = "prev", y = "heter_rate", x_values = c(0.02, 0.05, 0.08), y_values = c(0, 0.1, 0.2), target_power = 0.8 ) }
Finds the smallest sufficient integer total sample size for the three-group one-way ANOVA. Both denominator degrees of freedom and the non-centrality parameter are recalculated for every candidate sample size.
qtl_anova_mssn( power, alpha, qtl_var, tau, pd, count_method = c("rounded", "expected"), multiple_of_three = TRUE, verbose = TRUE )qtl_anova_mssn( power, alpha, qtl_var, tau, pd, count_method = c("rounded", "expected"), multiple_of_three = TRUE, verbose = TRUE )
power |
Target power in |
alpha |
Significance level in |
qtl_var |
Variance in the standardized trait attributable to the QTL.
Must be in |
tau |
Finite dominance-to-additivity ratio |
pd |
Frequency of the increaser allele. Must be in |
count_method |
Genotype count method. |
multiple_of_three |
Logical. If |
verbose |
Logical. If |
For every candidate integer N, the genotype counts, denominator
degrees of freedom, noncentrality parameter, critical F value, and achieved
power are recomputed. With count_method = "rounded", candidates for
which any genotype group has zero members are excluded. The first candidate
attaining power is returned; setting multiple_of_three = TRUE
restricts the search grid rather than changing the ANOVA formula. The model
and NCP follow textbook Eqs. 6.7–6.8 (p. 328).
An object of class "qtl_anova_mssn" containing the smallest
sufficient N, achieved power, degrees of freedom, non-centrality
parameter, genotype counts, and Falconer parameters.
Gordon, D., Finch, S. J., & Kim, W. (2020). Heterogeneity in Statistical Genetics: How to Assess, Address, and Account for Mixtures in Association Studies. Springer, Chapter 6, Section 6.1.1, Eqs. 6.7–6.8, p. 328. doi:10.1007/978-3-030-61121-7.
qtl_anova_power and
qtl_falconer_parameters.
qtl_anova_mssn( power = 0.8, alpha = 0.0001, qtl_var = 0.025, tau = 0.5, pd = 0.15, verbose = FALSE )qtl_anova_mssn( power = 0.8, alpha = 0.0001, qtl_var = 0.025, tau = 0.5, pd = 0.15, verbose = FALSE )
Calculates power for a one-way ANOVA comparing the means of the three SNP genotype groups for one continuous quantitative trait.
qtl_anova_power( N, alpha, qtl_var, tau, pd, count_method = c("rounded", "expected"), verbose = TRUE )qtl_anova_power( N, alpha, qtl_var, tau, pd, count_method = c("rounded", "expected"), verbose = TRUE )
N |
Integer total sample size greater than 3. |
alpha |
Significance level in |
qtl_var |
Variance in the standardized trait attributable to the QTL.
Must be in |
tau |
Finite dominance-to-additivity ratio |
pd |
Frequency of the increaser allele. Must be in |
count_method |
Genotype count method. |
verbose |
Logical. If |
The three genotype groups have the means returned by
qtl_falconer_parameters() and a common residual variance
. Genotype group counts are either rounded Hardy–Weinberg
expectations or unrounded expected counts according to count_method.
The between-group effect gives the noncentrality parameter in textbook
Eq. 6.8, and power is the upper tail of a noncentral F distribution with
numerator degrees of freedom 2 and denominator degrees of freedom
. Genotype counts follow Eq. 6.7 (Chapter 6, Section 6.1.1,
p. 328).
An object of class "qtl_anova_power" containing power,
sample size, degrees of freedom, critical value, non-centrality parameter,
genotype counts, genotype means, residual variance, and the complete
Falconer parameter object.
Gordon, D., Finch, S. J., & Kim, W. (2020). Heterogeneity in Statistical Genetics: How to Assess, Address, and Account for Mixtures in Association Studies. Springer, Chapter 6, Section 6.1.1, Eqs. 6.7–6.8, p. 328. doi:10.1007/978-3-030-61121-7.
qtl_anova_mssn and
qtl_falconer_parameters.
qtl_anova_power( N = 996, alpha = 0.0001, qtl_var = 0.025, tau = 0.5, pd = 0.15, verbose = FALSE )qtl_anova_power( N = 996, alpha = 0.0001, qtl_var = 0.025, tau = 0.5, pd = 0.15, verbose = FALSE )
Calculates genotype-specific normal-mixture parameters for a standardized continuous trait under the single-locus Falconer model.
qtl_falconer_parameters(qtl_var, tau, pd, verbose = TRUE)qtl_falconer_parameters(qtl_var, tau, pd, verbose = TRUE)
qtl_var |
Variance in the standardized trait attributable to the QTL.
Must be in |
tau |
Finite dominance-to-additivity ratio |
pd |
Frequency of the increaser allele. Must be in |
verbose |
Logical. If |
Genotypes are ordered as zero, one, and two copies of the increaser allele.
Their Hardy-Weinberg mixing proportions are
. The population-centering constant
makes the genotype-weighted trait mean zero, and the residual variance is
.
This is a classical, Falconer-style quantitative-genetic parameterization as formulated for this study-design framework by Gordon, Finch, and Kim (2020), Chapter 6, Section 6.1. The population mixture is Eq. 6.1 (p. 324); the additive effect, dominance effect, and centering formulas on p. 325 are unnumbered. The function name does not assert that every exact implemented expression is a numbered equation in Falconer and Mackay.
An object of class "qtl_falconer_parameters". The list contains
qtl_var, tau, pd, p_plus, additive effect
a, dominance effect delta, centering constant m,
genotype means mu, mixing proportions pi,
residual_variance, residual_sd, weighted_mean, and
total_variance.
Gordon, D., Finch, S. J., & Kim, W. (2020). Heterogeneity in Statistical Genetics: How to Assess, Address, and Account for Mixtures in Association Studies. Springer, Chapter 6, Section 6.1, pp. 324–325. doi:10.1007/978-3-030-61121-7.
Fisher, R. A. (1918). The correlation between relatives on the supposition of Mendelian inheritance. Transactions of the Royal Society of Edinburgh, 52, 399–433. doi:10.1017/S0080456800012163.
Lynch, M., & Walsh, B. (1998). Genetics and Analysis of Quantitative Traits. Sinauer Associates.
Falconer, D. S., & Mackay, T. F. C. (1996). Introduction to Quantitative Genetics, 4th ed. Longman.
qtl_falconer_threshold_parameters,
qtl_anova_power, and qtl_anova_mssn.
qtl_falconer_parameters(qtl_var = 0.025, tau = 0.5, pd = 0.15)qtl_falconer_parameters(qtl_var = 0.025, tau = 0.5, pd = 0.15)
Converts the genotype-specific Falconer trait distributions into upper-tail case and lower-tail control penetrances and conditional genotype frequencies.
qtl_falconer_threshold_parameters( qtl_var, tau, pd, threshold_mode = c("percentile", "direct"), x_upper = NULL, x_lower = NULL, upper_threshold = NULL, lower_threshold = NULL, verbose = TRUE )qtl_falconer_threshold_parameters( qtl_var, tau, pd, threshold_mode = c("percentile", "direct"), x_upper = NULL, x_lower = NULL, upper_threshold = NULL, lower_threshold = NULL, verbose = TRUE )
qtl_var |
Variance in the standardized trait attributable to the QTL.
Must be in |
tau |
Finite dominance-to-additivity ratio |
pd |
Frequency of the increaser allele. Must be in |
threshold_mode |
Either |
x_upper |
Percentage selected from the upper population tail in percentile mode. |
x_lower |
Percentage selected from the lower population tail in percentile mode. |
upper_threshold |
Direct upper-tail threshold in direct mode. |
lower_threshold |
Direct lower-tail threshold in direct mode. |
verbose |
Logical. If |
Cases are selected above the upper threshold and controls below the lower threshold. The middle portion is excluded, so the affected and unaffected selection events are not complements. Percentile inputs refer to standard normal population percentiles before conditioning on genotype. The genotype-specific normal mixture follows Eq. 6.1 (pp. 324–325). Genotype-specific upper- and lower-tail probabilities, their population prevalences, and conditional genotype frequencies follow Eqs. 6.3–6.5 (p. 326). Eq. 6.6 (p. 327) is a numerical worked example, not an additional symbolic step. This is a classical/Falconer-style parameterization as formulated for this design framework by Gordon, Finch, and Kim (2020).
An object of class "qtl_falconer_threshold_parameters" containing
thresholds, genotype-specific penetrances, selected-population
prevalences, conditional genotype frequencies, and Falconer parameters.
Gordon, D., Finch, S. J., & Kim, W. (2020). Heterogeneity in Statistical Genetics: How to Assess, Address, and Account for Mixtures in Association Studies. Springer, Chapter 6, Section 6.1, Eqs. 6.3–6.5, p. 326. doi:10.1007/978-3-030-61121-7.
Falconer, D. S., & Mackay, T. F. C. (1996). Introduction to Quantitative Genetics, 4th ed. Longman.
qtl_falconer_parameters,
qtl_threshold_chisq_power, and
qtl_threshold_chisq_mssn.
qtl_falconer_threshold_parameters( qtl_var = 0.025, tau = 0.5, pd = 0.15, x_upper = 5, x_lower = 5 )qtl_falconer_threshold_parameters( qtl_var = 0.025, tau = 0.5, pd = 0.15, x_upper = 5, x_lower = 5 )
Finds the minimum integer total sample size for Pillai MANOVA or the minimum selected case-control sample for a joint-threshold genotype chi-square test.
qtl_multivariate_mssn_full( power, alpha, qtl_var, tau, pd, cor_matrix, test = c("pillai", "threshold_chisq"), x_upper = NULL, x_lower = NULL, k = 1, verbose = TRUE )qtl_multivariate_mssn_full( power, alpha, qtl_var, tau, pd, cor_matrix, test = c("pillai", "threshold_chisq"), x_upper = NULL, x_lower = NULL, k = 1, verbose = TRUE )
power |
Target power in (0, 1). |
alpha |
Significance level in (0, 1). |
qtl_var |
Numeric vector of phenotype-specific QTL variances in (0, 1). |
tau |
Numeric vector of phenotype-specific dominance/additivity ratios. |
pd |
Shared increaser-allele frequency in (0, 1). |
cor_matrix |
Positive-definite phenotype correlation matrix. Its order
must match |
test |
Either |
x_upper, x_lower
|
Vectors of upper- and lower-tail percentages. A case satisfies every upper threshold (joint AND); a control satisfies every lower threshold (joint AND). |
k |
Control/case ratio for the threshold chi-square design. |
verbose |
Logical; whether to print a polished summary. |
Pillai MSSN is found by an integer search because its denominator degrees of
freedom depend on sample size. For threshold selection, the statistical MSSN
is kept separate from the expected population screening burden.
The Pillai branch recomputes its noncentral F distribution at each candidate
total N; the returned integer is the first design attaining the target
power. The historical fractional root is retained only for comparison. The
threshold branch uses direct multivariate-normal rectangle integration from
Eqs. 6.11–6.14 and genotype chi-square Eq. 1.22; it solves for selected
cases and controls and reports source-population screening expectations
separately. The two branches therefore return different sample-size units.
An object of class "qtl_multivariate_mssn_full". Both modes
include test, target and achieved power, alpha, and the full
falconer model. The Pillai result includes integer total N,
historical_fractional_mssn, genotype counts, NCP, degrees of freedom,
critical value, and all pillai intermediates. The threshold result
includes selected case/control/total MSSNs, target and achieved NCPs,
internal S, thresholds and integration diagnostics, expected genotype
counts, sparse-cell diagnostics, and separately labelled expected
source-population screening counts.
Gordon, D., Finch, S. J., & Kim, W. (2020). Heterogeneity in Statistical Genetics: How to Assess, Address, and Account for Mixtures in Association Studies. Springer, Chapter 6, Section 6.2, Eqs. 6.9–6.14, pp. 332–333; validation in Section 6.2.4, pp. 336–339. doi:10.1007/978-3-030-61121-7.
Gordon, D., Londono, D., Patel, P., Kim, W., Finch, S. J., & Heiman, G. A. (2017). An analytic solution to computation of power and sample size for genetic association studies under a pleiotropic mode of inheritance. Human Heredity, 81(4), 194–209. doi:10.1159/000457135.
Pillai, K. C. S. (1955). Some new test criteria in multivariate analysis. Annals of Mathematical Statistics, 26(1), 117–121. doi:10.1214/aoms/1177728599.
Genz, A., & Bretz, F. (2009). Computation of Multivariate Normal and t Probabilities. Springer. doi:10.1007/978-3-642-01689-9.
qtl_multivariate_power_full,
qtl_falconer_parameters, and
qtl_threshold_chisq_mssn.
cor_matrix <- matrix(c(1, 0.15, 0.15, 1), 2, byrow = TRUE) qtl_multivariate_mssn_full( power = 0.95, alpha = 5e-8, qtl_var = c(0.01, 0.005), tau = c(0, 0.5), pd = 0.25, cor_matrix = cor_matrix, test = "pillai", verbose = FALSE )cor_matrix <- matrix(c(1, 0.15, 0.15, 1), 2, byrow = TRUE) qtl_multivariate_mssn_full( power = 0.95, alpha = 5e-8, qtl_var = c(0.01, 0.005), tau = c(0, 0.5), pd = 0.25, cor_matrix = cor_matrix, test = "pillai", verbose = FALSE )
Computes prospective power for a one-way MANOVA using Pillai's trace or for a genotype chi-square test after joint multivariate threshold selection.
qtl_multivariate_power_full( N = NULL, N_case = NULL, alpha, qtl_var, tau, pd, cor_matrix, test = c("pillai", "threshold_chisq"), x_upper = NULL, x_lower = NULL, k = 1, verbose = TRUE )qtl_multivariate_power_full( N = NULL, N_case = NULL, alpha, qtl_var, tau, pd, cor_matrix, test = c("pillai", "threshold_chisq"), x_upper = NULL, x_lower = NULL, k = 1, verbose = TRUE )
N |
Integer total sample size for |
N_case |
Selected case sample size for
|
alpha |
Significance level in (0, 1). |
qtl_var |
Numeric vector of phenotype-specific QTL variances in (0, 1). |
tau |
Numeric vector of phenotype-specific dominance/additivity ratios. |
pd |
Shared increaser-allele frequency in (0, 1). |
cor_matrix |
Positive-definite phenotype correlation matrix. Its order
must match |
test |
Either |
x_upper, x_lower
|
Vectors of upper- and lower-tail percentages. A case satisfies every upper threshold (joint AND); a control satisfies every lower threshold (joint AND). |
k |
Control/case ratio for the threshold chi-square design. |
verbose |
Logical; whether to print a polished summary. |
Genotype-specific means are stored in a matrix whose rows are phenotypes and
columns are genotypes 0, 1, and 2. All genotypes share the residual
covariance matrix formed by scaling cor_matrix by residual standard
deviations. Joint probabilities use mvtnorm::pmvnorm() with the
deterministic Miwa algorithm through 20 dimensions; higher dimensions use
reproducibly seeded Genz–Bretz integration and return its error/status.
Pillai power follows Gordon et al.'s general matrix derivation: the characteristic roots of Phi-star determine V-star and lambda = N s V-star / (s - V-star). The null critical value and alternative power use central and noncentral F distributions.
The two test branches are distinct. With test = "pillai",
N is a total sample size and the function performs a three-genotype
one-way MANOVA using Pillai's trace. With
test = "threshold_chisq", N_case is a selected case count;
cases must exceed every upper threshold and controls must fall below every
lower threshold, after which their conditional genotype probabilities are
compared by a two-df chi-square test. The latter is not a MANOVA.
The multivariate mixture and component densities correspond to textbook Eqs. 6.9–6.10; rectangular probabilities to Eq. 6.11; and prevalence and bound construction to Eqs. 6.12–6.14 (Chapter 6, Section 6.2, pp. 332–333). The threshold branch then uses genotype chi-square Eq. 1.22 (p. 26). Eq. 6.15 is not used by this direct-integration implementation.
An object of class "qtl_multivariate_power_full". Both modes
contain test, alpha, power, and falconer, the
complete multivariate mixture model. For test = "pillai", additional
components include total N, genotype frequencies/counts, the NCP,
numerator and denominator degrees of freedom, critical value, and
pillai, containing contrasts, characteristic roots, Pillai trace,
and matrix intermediates. For test = "threshold_chisq", components
include selected N_case, N_control, and N_total,
k, two-df NCP, internal S, thresholds (bounds,
penetrances, prevalences, conditional genotype frequencies, and integration
diagnostics), expected genotype counts, and sparse-cell diagnostics.
Gordon, D., Finch, S. J., & Kim, W. (2020). Heterogeneity in Statistical Genetics: How to Assess, Address, and Account for Mixtures in Association Studies. Springer, Chapter 6, Section 6.2, Eqs. 6.9–6.14, pp. 332–333; validation in Section 6.2.4, pp. 336–339. doi:10.1007/978-3-030-61121-7.
Gordon, D., Londono, D., Patel, P., Kim, W., Finch, S. J., & Heiman, G. A. (2017). An analytic solution to computation of power and sample size for genetic association studies under a pleiotropic mode of inheritance. Human Heredity, 81(4), 194–209. doi:10.1159/000457135.
Pillai, K. C. S. (1955). Some new test criteria in multivariate analysis. Annals of Mathematical Statistics, 26(1), 117–121. doi:10.1214/aoms/1177728599.
Genz, A., & Bretz, F. (2009). Computation of Multivariate Normal and t Probabilities. Springer. doi:10.1007/978-3-642-01689-9.
qtl_multivariate_mssn_full,
qtl_falconer_parameters, and
qtl_threshold_chisq_power.
cor_matrix <- matrix(c(1, 0.15, 0.15, 1), 2, byrow = TRUE) qtl_multivariate_power_full( N = 4514, alpha = 5e-8, qtl_var = c(0.01, 0.005), tau = c(0, 0.5), pd = 0.25, cor_matrix = cor_matrix, test = "pillai", verbose = FALSE )cor_matrix <- matrix(c(1, 0.15, 0.15, 1), 2, byrow = TRUE) qtl_multivariate_power_full( N = 4514, alpha = 5e-8, qtl_var = c(0.01, 0.005), tau = c(0, 0.5), pd = 0.25, cor_matrix = cor_matrix, test = "pillai", verbose = FALSE )
Calculates the minimum selected case and control sample sizes after deriving their genotype distributions from a single-trait Falconer threshold model.
qtl_threshold_chisq_mssn( power, alpha, qtl_var, tau, pd, x_upper, x_lower, k = 1, verbose = TRUE )qtl_threshold_chisq_mssn( power, alpha, qtl_var, tau, pd, x_upper, x_lower, k = 1, verbose = TRUE )
power |
Target power in |
alpha |
Significance level in |
qtl_var |
Variance in the standardized trait attributable to the QTL.
Must be in |
tau |
Finite dominance-to-additivity ratio |
pd |
Frequency of the increaser allele. Must be in |
x_upper |
Percentage selected from the upper population tail in percentile mode. |
x_lower |
Percentage selected from the lower population tail in percentile mode. |
k |
Positive control-to-case ratio |
verbose |
Logical. If |
The primary MSSN is the selected case-control sample size used by the association test. The separately reported screening quantities are expected population counts needed to obtain those selected samples under simple population sampling; they are not statistical MSSN values. Genotype-specific distributions and threshold selection follow Eqs. 6.1 and 6.3–6.5 (pp. 324–326). The downstream genotype-test NCP is Eq. 1.22 (p. 26). The function solves for selected cases and controls; expected screening counts are reported separately and are not rounded MSSNs.
An object of class "qtl_threshold_chisq_mssn" containing
selected MSSN values, target NCP, internal S, thresholds,
penetrances, prevalences, conditional frequencies, Falconer parameters,
and separately labelled expected population screening counts.
Gordon, D., Finch, S. J., & Kim, W. (2020). Heterogeneity in Statistical Genetics: How to Assess, Address, and Account for Mixtures in Association Studies. Springer, Eqs. 1.22, 6.1, and 6.3–6.5, pp. 26 and 324–326. doi:10.1007/978-3-030-61121-7.
qtl_threshold_chisq_power and
qtl_falconer_threshold_parameters.
qtl_threshold_chisq_mssn( power = 0.8, alpha = 0.0001, qtl_var = 0.025, tau = 0.5, pd = 0.15, x_upper = 5, x_lower = 5, verbose = FALSE )qtl_threshold_chisq_mssn( power = 0.8, alpha = 0.0001, qtl_var = 0.025, tau = 0.5, pd = 0.15, x_upper = 5, x_lower = 5, verbose = FALSE )
Calculates power for the 2-df genotype chi-square test after a quantitative trait is converted into upper-tail cases and lower-tail controls.
qtl_threshold_chisq_power( N_case, alpha, qtl_var, tau, pd, x_upper, x_lower, k = 1, verbose = TRUE )qtl_threshold_chisq_power( N_case, alpha, qtl_var, tau, pd, x_upper, x_lower, k = 1, verbose = TRUE )
N_case |
Positive number of selected cases. |
alpha |
Significance level in |
qtl_var |
Variance in the standardized trait attributable to the QTL.
Must be in |
tau |
Finite dominance-to-additivity ratio |
pd |
Frequency of the increaser allele. Must be in |
x_upper |
Percentage selected from the upper population tail in percentile mode. |
x_lower |
Percentage selected from the lower population tail in percentile mode. |
k |
Positive control-to-case ratio |
verbose |
Logical. If |
Genotype-specific normal means and the common residual variance follow the
mixture in Eq. 6.1. Upper-tail cases and lower-tail controls are constructed
with Eqs. 6.3–6.5 (pp. 324–326); the middle of the trait distribution is
excluded. The resulting conditional genotype probabilities are compared by
the two-degree-of-freedom genotype chi-square test using Eq. 1.22 (p. 26).
N_case and k * N_case are selected case and control counts,
not numbers screened from the source population.
An object of class "qtl_threshold_chisq_power" containing
selected sample sizes, power, non-centrality parameter, internal effect
component S, thresholds, penetrances, prevalences, conditional
genotype frequencies, and Falconer parameters.
Gordon, D., Finch, S. J., & Kim, W. (2020). Heterogeneity in Statistical Genetics: How to Assess, Address, and Account for Mixtures in Association Studies. Springer, Eqs. 1.22, 6.1, and 6.3–6.5, pp. 26 and 324–326. doi:10.1007/978-3-030-61121-7.
qtl_threshold_chisq_mssn and
qtl_falconer_threshold_parameters.
qtl_threshold_chisq_power( N_case = 126, alpha = 0.0001, qtl_var = 0.025, tau = 0.5, pd = 0.15, x_upper = 5, x_lower = 5, verbose = FALSE )qtl_threshold_chisq_power( N_case = 126, alpha = 0.0001, qtl_var = 0.025, tau = 0.5, pd = 0.15, x_upper = 5, x_lower = 5, verbose = FALSE )
Computes the expected non-transmission probability () for the
Transmission Disequilibrium Test (TDT) under a general model including linkage
disequilibrium (LD), relative risks, and phenotype misclassification.
Implements Equation 5.25 from Gordon et al. (2020),
Heterogeneity in Statistical Genetics.
tdt_expected_nontransmission_probability( pd, prev, R1, R2, delta_prime = 1, pi01 = 0, theta1 = NULL, digits = 6, verbose = TRUE )tdt_expected_nontransmission_probability( pd, prev, R1, R2, delta_prime = 1, pi01 = 0, theta1 = NULL, digits = 6, verbose = TRUE )
pd |
Numeric. Frequency of the disease-associated allele. |
prev |
Numeric. Disease prevalence ( |
R1 |
Numeric. Relative risk for heterozygotes. |
R2 |
Numeric. Relative risk for homozygotes. |
delta_prime |
Numeric. Linkage disequilibrium scale parameter ( |
pi01 |
Numeric. Misclassification rate (default = 0). |
theta1 |
Numeric. Population allele frequency (defaults to |
digits |
Integer. Number of digits for printing (default = 6). |
verbose |
Logical. If |
The function derives intermediate penetrance-weighted frequencies
and the contrast term , which captures differences in genotype contributions.
Linkage disequilibrium is represented by .
The expected non-transmission probability is then:
When , this reduces to the standard non-misclassified case.
This is Eq. 5.25 in Chapter 5, Section 5.2.6 (pp. 284–285).
gNT_star is a probability, not an expected count.
A list containing:
gNT_star |
Expected non-transmission probability ( |
C, D
|
Contrast and LD terms. |
f0, f1, f2
|
Derived penetrance frequencies. |
pd, phi1, phi0, theta1
|
Input and derived parameters. |
Buyske, S., Yang, G., Matise, T. C., & Gordon, D. (2009). When a case is not a case: Effects of phenotype misclassification on power and sample size requirements for the transmission disequilibrium test with affected child trios. Human Heredity, 67(4), 287–292. doi:10.1159/000194981. PMID: 19172087.
Gordon, D., Finch, S. J., & Kim, W. (2020). Heterogeneity in Statistical Genetics: How to Assess, Address, and Account for Mixtures in Association Studies. Springer. doi:10.1007/978-3-030-61121-7.
tdt_expected_transmission_probability,
tdt_expected_transmission_counts, and tdt_power.
# Example: compute gNT* under no misclassification tdt_expected_nontransmission_probability( pd = 0.25, prev = 0.005, R1 = 2, R2 = 2, delta_prime = 1, pi01 = 0 ) # Example: with 10% misclassification tdt_expected_nontransmission_probability( pd = 0.25, prev = 0.005, R1 = 2, R2 = 2, delta_prime = 1, pi01 = 0.1 )# Example: compute gNT* under no misclassification tdt_expected_nontransmission_probability( pd = 0.25, prev = 0.005, R1 = 2, R2 = 2, delta_prime = 1, pi01 = 0 ) # Example: with 10% misclassification tdt_expected_nontransmission_probability( pd = 0.25, prev = 0.005, R1 = 2, R2 = 2, delta_prime = 1, pi01 = 0.1 )
Computes the expected number of transmissions () and non-transmissions ()
for a given number of affected trios under heterogeneity and linkage disequilibrium models.
Implements Equations 5.31-5.32 from Gordon et al. (2020),
Heterogeneity in Statistical Genetics.
tdt_expected_transmission_counts( N_star, pd, prev, R1, R2, delta_prime = 1, pi = 1, theta1 = NULL, digits = 6, verbose = TRUE )tdt_expected_transmission_counts( N_star, pd, prev, R1, R2, delta_prime = 1, pi = 1, theta1 = NULL, digits = 6, verbose = TRUE )
N_star |
Numeric. Number of affected trios. |
pd |
Numeric. Frequency of the disease-associated allele. |
prev |
Numeric. Disease prevalence ( |
R1 |
Numeric. Relative risk for heterozygotes. |
R2 |
Numeric. Relative risk for homozygotes. |
delta_prime |
Numeric. Linkage disequilibrium scale parameter ( |
pi |
Numeric in |
theta1 |
Numeric. Population allele frequency (defaults to |
digits |
Integer. Number of digits for printing (default = 6). |
verbose |
Logical. If |
The expected transmissions () and non-transmissions () are computed as:
These are Eqs. 5.31–5.32 in Chapter 5, Section 5.3.3 (pp. 293–294).
They are expected counts over N_star affected trios. Dividing by
gives the corresponding and
probabilities. The canonical heter_rate used by tdt_power()
and tdt_mssn() equals .
A list containing:
ET_star |
Expected transmissions ( |
ENT_star |
Expected non-transmissions ( |
C, D
|
Contrast and LD terms. |
f0, f1, f2
|
Derived penetrance frequencies. |
pd, prev, R1, R2, pi, theta1
|
Input parameters. |
Chen, C., Yang, G., Buyske, S., Matise, T., Finch, S. J., & Gordon, D. (2009). Transmission disequilibrium test power and sample size in the presence of locus heterogeneity. Statistical Applications in Genetics and Molecular Biology, 8, Article 44. doi:10.2202/1544-6115.1501. PMID: 19883370.
Gordon, D., Finch, S. J., & Kim, W. (2020). Heterogeneity in Statistical Genetics: How to Assess, Address, and Account for Mixtures in Association Studies. Springer. doi:10.1007/978-3-030-61121-7.
tdt_power, tdt_mssn, and
tdt_mssn_from_model.
# Example 1: Homogeneous model (pi = 1) tdt_expected_transmission_counts( N_star = 1000, pd = 0.25, prev = 0.005, R1 = 2, R2 = 2, delta_prime = 1, pi = 1 ) # Example 2: Heterogeneous model (pi = 0.7) tdt_expected_transmission_counts( N_star = 1000, pd = 0.25, prev = 0.005, R1 = 2, R2 = 2, delta_prime = 1, pi = 0.7 )# Example 1: Homogeneous model (pi = 1) tdt_expected_transmission_counts( N_star = 1000, pd = 0.25, prev = 0.005, R1 = 2, R2 = 2, delta_prime = 1, pi = 1 ) # Example 2: Heterogeneous model (pi = 0.7) tdt_expected_transmission_counts( N_star = 1000, pd = 0.25, prev = 0.005, R1 = 2, R2 = 2, delta_prime = 1, pi = 0.7 )
Computes the expected transmission probability () for the
Transmission Disequilibrium Test (TDT), incorporating effects of linkage
disequilibrium (LD), relative risks, and phenotype misclassification.
Implements Equation 5.24 from Gordon et al. (2020),
Heterogeneity in Statistical Genetics.
tdt_expected_transmission_probability( pd, prev, R1, R2, delta_prime = 1, pi01 = 0, theta1 = NULL, digits = 6, verbose = TRUE )tdt_expected_transmission_probability( pd, prev, R1, R2, delta_prime = 1, pi01 = 0, theta1 = NULL, digits = 6, verbose = TRUE )
pd |
Numeric. Frequency of the disease-associated allele. |
prev |
Numeric. Disease prevalence ( |
R1 |
Numeric. Relative risk for heterozygotes. |
R2 |
Numeric. Relative risk for homozygotes. |
delta_prime |
Numeric. Linkage disequilibrium scale parameter ( |
pi01 |
Numeric. Misclassification rate (default = 0). |
theta1 |
Numeric. Population allele frequency (defaults to |
digits |
Integer. Number of digits for printed results (default = 6). |
verbose |
Logical. If |
The function computes the penetrance-weighted genotype frequencies
and the contrast term , representing genotype-specific
effects. Linkage disequilibrium is modeled as .
The expected transmission probability is given by:
When , this reduces to the standard non-misclassified case.
This is Eq. 5.24 in Chapter 5, Section 5.2.6 (p. 284).
gT_star is a probability, not an expected count.
A list containing:
gT_star |
Expected transmission probability ( |
C, D
|
Contrast and LD terms. |
f0, f1, f2
|
Derived penetrance frequencies. |
pd, phi1, phi0, theta1
|
Input and derived parameters. |
Buyske, S., Yang, G., Matise, T. C., & Gordon, D. (2009). When a case is not a case: Effects of phenotype misclassification on power and sample size requirements for the transmission disequilibrium test with affected child trios. Human Heredity, 67(4), 287–292. doi:10.1159/000194981. PMID: 19172087.
Gordon, D., Finch, S. J., & Kim, W. (2020). Heterogeneity in Statistical Genetics: How to Assess, Address, and Account for Mixtures in Association Studies. Springer. doi:10.1007/978-3-030-61121-7.
tdt_expected_nontransmission_probability,
tdt_expected_transmission_counts, and tdt_power.
# Example 1 – no misclassification tdt_expected_transmission_probability( pd = 0.25, prev = 0.005, R1 = 2, R2 = 2, delta_prime = 1, pi01 = 0 ) # Example 2 – 10% misclassification tdt_expected_transmission_probability( pd = 0.25, prev = 0.005, R1 = 2, R2 = 2, delta_prime = 1, pi01 = 0.1 )# Example 1 – no misclassification tdt_expected_transmission_probability( pd = 0.25, prev = 0.005, R1 = 2, R2 = 2, delta_prime = 1, pi01 = 0 ) # Example 2 – 10% misclassification tdt_expected_transmission_probability( pd = 0.25, prev = 0.005, R1 = 2, R2 = 2, delta_prime = 1, pi01 = 0.1 )
Computes the minimum number of affected trios required to achieve a
specified power for the transmission disequilibrium test (TDT) with no
effect or one selected effect: phenotype misclassification, locus
heterogeneity, or genotype misclassification. input_mode lets the transmission
probabilities come either from a genetic model
("model_based", the default) or directly from user-supplied
expected transmission and non-transmission counts ("model_free").
tdt_mssn( target_power, input_mode = c("model_based", "model_free"), pd = NULL, prev = NULL, R1 = NULL, R2 = NULL, alpha = 0.05, delta_prime = 1, misclass_rate = 0, heter_rate = 0, ET = NULL, ENT = NULL, n_trios = NULL, verbose = TRUE, effect = c("none", "phenotype_misclassification", "locus_heterogeneity", "genotype_misclassification"), genotype_misclassification_rate = NULL )tdt_mssn( target_power, input_mode = c("model_based", "model_free"), pd = NULL, prev = NULL, R1 = NULL, R2 = NULL, alpha = 0.05, delta_prime = 1, misclass_rate = 0, heter_rate = 0, ET = NULL, ENT = NULL, n_trios = NULL, verbose = TRUE, effect = c("none", "phenotype_misclassification", "locus_heterogeneity", "genotype_misclassification"), genotype_misclassification_rate = NULL )
target_power |
Numeric in (0,1). Desired power for the TDT. |
input_mode |
Character. One of |
pd |
Numeric in (0,1). Frequency of the disease (high-risk) allele at
the marker locus. Required for |
prev |
Numeric in (0,1). Disease prevalence ( |
R1 |
Numeric |
R2 |
Numeric |
alpha |
Numeric in (0,1). Significance level for the TDT
(default |
delta_prime |
Numeric. Linkage disequilibrium scale parameter
|
misclass_rate |
Numeric in |
heter_rate |
Numeric in |
ET, ENT
|
Numeric |
n_trios |
Numeric |
verbose |
Logical. If |
effect |
Character. Optional explicit effect selector: |
genotype_misclassification_rate |
Numeric in |
With input_mode = "model_based", penetrances are derived from
prev, R1, R2, and pd, and
is computed for each of the three scenarios.
The no-error calculation follows Eq. 1.25 (p. 27); phenotype
misclassification follows Eqs. 5.24–5.27 (pp. 284–285); and locus
heterogeneity follows Eqs. 5.30–5.34b (pp. 293–294). Eq. 5.28 is a
numerical example. Here heter_rate is the heterogeneous fraction,
equal to when lower-level formulas use homogeneous fraction
.
Phenotype misclassification and locus heterogeneity are reported as
separate sensitivity scenarios; supplying both rates does not create a
combined-error scenario.
With input_mode = "model_free", the no-error scenario uses
and .
The misclassification and heterogeneity scenarios then use the same
closed-form identities as tdt_power (see its
Details for the formulas and the pd-solving fallback), applied to
this no-error / pair.
For effect = "genotype_misclassification", the Chapter 5
single-parameter adjacent-genotype TDT transition model,
Mendelian-inconsistency filtering, and
Eqs. 5.16–5.22 are the same as in tdt_power. The adjusted NCP
is linear in the number of affected trios, so the existing target-NCP is
divided by the adjusted per-trio NCP. This model-based branch cannot be
combined with phenotype misclassification or locus heterogeneity. TDTae and
sequencing/NGS genotype error are not implemented, and the result uses the
package's existing nominal asymptotic TDT convention.
An object of class "tdt_mssn", containing:
Design targets, target one-df NCP, and input mode.
Named no_error, misclassification, and
heterogeneity required affected-trio counts.
Modifier-specific conventional percentage inflation,
, relative to the no-error required
count. Values are NA when the no-error required count is not finite
and positive.
Power and power loss obtained if the no-error design size is used under each modifier.
Scenario-specific transmission and non-transmission probabilities used in the MSSN formulas.
Supplied and derived genetic-model, LD, misclassification, heterogeneity, and model-free count-scale information.
Spielman, R. S., McGinnis, R. E., & Ewens, W. J. (1993). Transmission test for linkage disequilibrium: the insulin gene region and insulin-dependent diabetes mellitus. American Journal of Human Genetics, 52(3), 506–516. PMID: 8447318; PMCID: PMC1682161.
Gordon, D., Finch, S. J., & Kim, W. (2020). Heterogeneity in Statistical Genetics: How to Assess, Address, and Account for Mixtures in Association Studies. Springer. doi:10.1007/978-3-030-61121-7.
Buyske, S., Yang, G., Matise, T. C., & Gordon, D. (2009). When a case is not a case: Effects of phenotype misclassification on power and sample size requirements for the transmission disequilibrium test with affected child trios. Human Heredity, 67(4), 287–292. doi:10.1159/000194981.
Chen, C., Yang, G., Buyske, S., Matise, T., Finch, S. J., & Gordon, D. (2009). Transmission disequilibrium test power and sample size in the presence of locus heterogeneity. Statistical Applications in Genetics and Molecular Biology, 8, Article 44. doi:10.2202/1544-6115.1501.
tdt_power for the power counterpart.
# Model-based input tdt_mssn( target_power = 0.80, input_mode = "model_based", pd = 0.30, prev = 0.05, R1 = 1.5, R2 = 2.25, verbose = FALSE )$N$no_error # Chapter 5 single-parameter adjacent-genotype TDT error tdt_mssn( target_power = 0.80, pd = 0.30, prev = 0.05, R1 = 1.5, R2 = 2.25, effect = "genotype_misclassification", genotype_misclassification_rate = 0.01, verbose = FALSE )$N$genotype_misclassification # model_free: supply expected transmissions/non-transmissions directly tdt_mssn( target_power = 0.80, input_mode = "model_free", ET = 140, ENT = 100, n_trios = 120, pd = 0.30, prev = 0.05, verbose = FALSE )$N$no_error# Model-based input tdt_mssn( target_power = 0.80, input_mode = "model_based", pd = 0.30, prev = 0.05, R1 = 1.5, R2 = 2.25, verbose = FALSE )$N$no_error # Chapter 5 single-parameter adjacent-genotype TDT error tdt_mssn( target_power = 0.80, pd = 0.30, prev = 0.05, R1 = 1.5, R2 = 2.25, effect = "genotype_misclassification", genotype_misclassification_rate = 0.01, verbose = FALSE )$N$genotype_misclassification # model_free: supply expected transmissions/non-transmissions directly tdt_mssn( target_power = 0.80, input_mode = "model_free", ET = 140, ENT = 100, n_trios = 120, pd = 0.30, prev = 0.05, verbose = FALSE )$N$no_error
Computes the required number of affected trios () needed to achieve
a specified statistical power in the Transmission Disequilibrium Test (TDT),
given model parameters for allele frequency, relative risks, disease prevalence,
and heterogeneity. Implements the probability and MSSN chain in
Eqs. 5.33–5.34b (Chapter 5, Section 5.3.3, pp. 293–294) of Gordon,
Finch, and Kim (2020).
tdt_mssn_from_model( power, alpha, df, pd, prev, R1, R2, delta_prime = 1, pi = 1 )tdt_mssn_from_model( power, alpha, df, pd, prev, R1, R2, delta_prime = 1, pi = 1 )
power |
Numeric. Desired power (e.g., 0.8). |
alpha |
Numeric. Significance level (e.g., 0.05). |
df |
Integer. Degrees of freedom (typically 1 for TDT). |
pd |
Numeric. Frequency of the disease-associated allele. |
prev |
Numeric. Disease prevalence. |
R1 |
Numeric. Relative risk for heterozygotes. |
R2 |
Numeric. Relative risk for homozygotes. |
delta_prime |
Numeric. Linkage disequilibrium (LD) scale factor (default = 1). |
pi |
Numeric in |
This function determines the non-centrality parameter () via
root-finding (uniroot) such that the test power equals the desired level.
It then computes the expected transmission () and non-transmission
() probabilities, followed by the required number of trios using:
The expected transmission and non-transmission components are calculated under allele frequency and penetrance model assumptions in Eq. 5.33. Their NCP and MSSN are Eqs. 5.34a–b.
A list containing:
lambda_star |
Non-centrality parameter ( |
gT_star |
Expected transmission probability. |
gNT_star |
Expected non-transmission probability. |
N_star |
Required number of trios. |
Chen, C., Yang, G., Buyske, S., Matise, T., Finch, S. J., & Gordon, D. (2009). Transmission disequilibrium test power and sample size in the presence of locus heterogeneity. Statistical Applications in Genetics and Molecular Biology, 8, Article 44. doi:10.2202/1544-6115.1501.
Gordon, D., Finch, S. J., & Kim, W. (2020). Heterogeneity in Statistical Genetics: How to Assess, Address, and Account for Mixtures in Association Studies. Springer. doi:10.1007/978-3-030-61121-7.
tdt_mssn, tdt_power_from_model, and
tdt_expected_transmission_counts.
# Example: compute required trios for 80% power at alpha = 0.05 tdt_mssn_from_model( power = 0.8, alpha = 0.05, df = 1, pd = 0.25, prev = 0.005, R1 = 2, R2 = 2, delta_prime = 1, pi = 1 )# Example: compute required trios for 80% power at alpha = 0.05 tdt_mssn_from_model( power = 0.8, alpha = 0.05, df = 1, pd = 0.25, prev = 0.005, R1 = 2, R2 = 2, delta_prime = 1, pi = 1 )
Computes the expected transmissions () and non-transmissions ()
as well as the required number of trios () for a specified non-centrality parameter
() under a misclassification model. Implements Eq. 5.26 and
Eqs. 5.27a–b (Chapter 5, Section 5.2.6, pp. 284–285) of Gordon, Finch,
and Kim (2020). Eq. 5.28a–b is the book's numerical worked example.
tdt_mssn_phenotype_misclassification_from_ncp( lambda_star, pd, prev, R1, R2, delta_prime = 1, pi01 = 0, digits = 5 )tdt_mssn_phenotype_misclassification_from_ncp( lambda_star, pd, prev, R1, R2, delta_prime = 1, pi01 = 0, digits = 5 )
lambda_star |
Numeric. Non-centrality parameter ( |
pd |
Numeric. Frequency of the disease-associated allele. |
prev |
Numeric. Disease prevalence ( |
R1 |
Numeric. Relative risk for heterozygotes. |
R2 |
Numeric. Relative risk for homozygotes. |
delta_prime |
Numeric. Linkage disequilibrium scale parameter ( |
pi01 |
Numeric. Misclassification rate for controls (default = 0). |
digits |
Integer. Number of digits to round intermediate printed results (default = 5). |
This function adjusts the Transmission Disequilibrium Test (TDT) for possible
phenotype misclassification. When , a fraction of unaffected
individuals are incorrectly classified as affected, inflating the apparent
transmission probability. The expected transmission () and non-transmission
() are calculated as:
The required number of trios is then:
Setting reproduces the standard (non-misclassified) TDT.
A list containing:
gT_star |
Expected transmission probability. |
gNT_star |
Expected non-transmission probability. |
N_required |
Required number of trios ( |
lambda_star |
Non-centrality parameter. |
C, f0, f1, f2
|
Intermediate derived values used in Eq. 5.26. |
Buyske, S., Yang, G., Matise, T. C., & Gordon, D. (2009). When a case is not a case: Effects of phenotype misclassification on power and sample size requirements for the transmission disequilibrium test with affected child trios. Human Heredity, 67(4), 287–292. doi:10.1159/000194981. PMID: 19172087.
Gordon, D., Finch, S. J., & Kim, W. (2020). Heterogeneity in Statistical Genetics: How to Assess, Address, and Account for Mixtures in Association Studies. Springer. doi:10.1007/978-3-030-61121-7.
tdt_mssn,
tdt_expected_transmission_probability, and
tdt_expected_nontransmission_probability.
# Example: Compute N* with misclassification adjustment (pi01 = 0.1) tdt_mssn_phenotype_misclassification_from_ncp( lambda_star = 7.8488, pd = 0.25, prev = 0.005, R1 = 2, R2 = 2, delta_prime = 1, pi01 = 0.1 )# Example: Compute N* with misclassification adjustment (pi01 = 0.1) tdt_mssn_phenotype_misclassification_from_ncp( lambda_star = 7.8488, pd = 0.25, prev = 0.005, R1 = 2, R2 = 2, delta_prime = 1, pi01 = 0.1 )
Computes the prospective minimum sample size necessary (MSSN), measured in
complete father-mother-affected-child trios, for the same single-variant
TDT1-NGS design as tdt_ngs_power().
tdt_ngs_mssn( power, pd, R1, coverage = NULL, seq_error = NULL, alpha = 0.05, verbose = TRUE, father_coverage = coverage, mother_coverage = coverage, child_coverage = coverage, epsilon0 = seq_error, epsilon1 = seq_error, pheno_misclass = FALSE, prev = NULL, pi01 = 0, locus_het = FALSE, heter_rate = 0 )tdt_ngs_mssn( power, pd, R1, coverage = NULL, seq_error = NULL, alpha = 0.05, verbose = TRUE, father_coverage = coverage, mother_coverage = coverage, child_coverage = coverage, epsilon0 = seq_error, epsilon1 = seq_error, pheno_misclass = FALSE, prev = NULL, pi01 = 0, locus_het = FALSE, heter_rate = 0 )
power |
A single finite target power strictly between 0 and 1. |
pd |
A single finite disease/risk-allele frequency strictly between 0 and 1. The supplied allele labeling is retained. |
R1 |
A single finite positive heterozygote genotype relative risk under
the multiplicative model. The homozygote relative risk is
|
coverage |
A single finite integer greater than or equal to 2. Common fixed-depth shorthand for the father, mother, and affected child. It may be omitted when all three member-specific depths are supplied. |
seq_error |
A single finite symmetric per-read sequencing-error
probability in |
alpha |
A single finite significance level in |
verbose |
Logical scalar. If |
father_coverage, mother_coverage, child_coverage
|
Optional fixed depths
for each trio member. An explicitly supplied member depth overrides
|
epsilon0 |
Directional probability that a reference-allele read is
observed as the alternative allele. Defaults to |
epsilon1 |
Directional probability that an alternative-allele read is
observed as the reference allele. Defaults to |
pheno_misclass |
Logical scalar. If |
prev |
Disease prevalence in |
pi01 |
Probability that an unaffected individual is misclassified or
ascertained as affected, in |
locus_het |
Logical scalar. If |
heter_rate |
Heterogeneous trio fraction in |
The calculation uses Kim's Appendix B TDT1-NGS noncentrality parameter
where is the number of complete trios, is the
nuisance-adjusted per-trio information under the null, and under the
multiplicative model . The target one-degree-of-
freedom NCP, , is obtained by numerical inversion of the
noncentral chi-square power function. Trio MSSN is then solved analytically:
The planned MSSN is the ceiling of this quantity, with achieved power and
the immediately smaller design checked at the integer boundary.
For the optional phenotype scenario, the ordinary-TDT attenuation factor
described in tdt_ngs_power multiplies the
per-trio coefficient before inversion:
The bridge fixes , , and
. It does not modify Kim's likelihood or information
matrix and is not a TDTae or simulation model.
For locus heterogeneity, is the ratio of the ordinary-TDT
heterogeneous and homogeneous per-trio NCP coefficients, with
heter_rate. The adjusted coefficient is
before inversion. Phenotype and
heterogeneity requests remain separate scenarios; no product of their
attenuation factors is used.
If target power is no greater than alpha, the target NCP is
zero and the minimum supported design is one trio. If R1 = 1 and
target power exceeds alpha, no finite MSSN exists because the transmission
effect is zero.
Each member uses its resolved fixed coverage, and the directional read model
is . See
tdt_ngs_power for parameter precedence and interpretation.
Coverage 1 is unsupported for every member because efficient information is
not identifiable under the implemented 11-parameter nuisance model. This prospective
calculation uses raw sequencing read-count information and latent trio
genotype states; it performs no simulation, genotype calling, or EM fitting.
Invisibly, an object of class "tdt_ngs_mssn" containing the
target, continuous and integer trio requirements, achieved power and NCP,
per-trio NCP coefficient, multiplicative-model parameters, efficient
information, the 11 by 11 information matrix, numerical diagnostics,
effective sequencing-design metadata, model metadata, and scenario-level
base and independently adjusted coefficients and sample sizes. Legacy
coverage and seq_error fields retain supplied shorthand.
Kim, W. (2015). Transmission disequilibrium tests based on read counts for low-coverage next-generation sequence data. Human Heredity, 80(1), 36–49. doi:10.1159/000434645.
Buyske, S., Yang, G., Matise, T. C., & Gordon, D. (2009). When a case is not a case: Effects of phenotype misclassification on power and sample size requirements for the transmission disequilibrium test with affected child trios. Human Heredity, 67(4), 287–292. doi:10.1159/000194981.
Chen, C., Yang, G., Buyske, S., Matise, T., Finch, S. J., & Gordon, D. (2009). Transmission disequilibrium test power and sample size in the presence of locus heterogeneity. Statistical Applications in Genetics and Molecular Biology, 8, Article 44. doi:10.2202/1544-6115.1501.
Gordon, D., Finch, S. J., & Kim, W. (2020). Heterogeneity in Statistical Genetics: How to Assess, Address, and Account for Mixtures in Association Studies. Springer. doi:10.1007/978-3-030-61121-7.
tdt_ngs_mssn( power = 0.80, pd = 0.325, R1 = 1.2, coverage = 12, seq_error = 0.005, alpha = 5e-8, verbose = FALSE ) tdt_ngs_mssn( power = 0.80, pd = 0.325, R1 = 1.2, coverage = 12, seq_error = 0.005, locus_het = TRUE, prev = 0.01, heter_rate = 0.25, alpha = 5e-8, verbose = FALSE ) tdt_ngs_mssn( power = 0.80, pd = 0.325, R1 = 1.2, coverage = 12, seq_error = 0.005, pheno_misclass = TRUE, prev = 0.01, pi01 = 0.05, alpha = 5e-8, verbose = FALSE )tdt_ngs_mssn( power = 0.80, pd = 0.325, R1 = 1.2, coverage = 12, seq_error = 0.005, alpha = 5e-8, verbose = FALSE ) tdt_ngs_mssn( power = 0.80, pd = 0.325, R1 = 1.2, coverage = 12, seq_error = 0.005, locus_het = TRUE, prev = 0.01, heter_rate = 0.25, alpha = 5e-8, verbose = FALSE ) tdt_ngs_mssn( power = 0.80, pd = 0.325, R1 = 1.2, coverage = 12, seq_error = 0.005, pheno_misclass = TRUE, prev = 0.01, pi01 = 0.05, alpha = 5e-8, verbose = FALSE )
Computes prospective analytic power for a single-variant TDT1-NGS study of complete father-mother-affected-child trios. The implementation uses the published latent-state, sequencing-read-count likelihood rather than hard genotype calls.
tdt_ngs_power( N, pd, R1, coverage = NULL, seq_error = NULL, alpha = 0.05, verbose = TRUE, father_coverage = coverage, mother_coverage = coverage, child_coverage = coverage, epsilon0 = seq_error, epsilon1 = seq_error, pheno_misclass = FALSE, prev = NULL, pi01 = 0, locus_het = FALSE, heter_rate = 0 )tdt_ngs_power( N, pd, R1, coverage = NULL, seq_error = NULL, alpha = 0.05, verbose = TRUE, father_coverage = coverage, mother_coverage = coverage, child_coverage = coverage, epsilon0 = seq_error, epsilon1 = seq_error, pheno_misclass = FALSE, prev = NULL, pi01 = 0, locus_het = FALSE, heter_rate = 0 )
N |
A single finite integer greater than or equal to 1. Number of complete father-mother-affected-child trios. |
pd |
A single finite disease/risk-allele frequency strictly between 0
and 1. The null information is reflection-symmetric in |
R1 |
A single finite positive heterozygote genotype relative risk under
the multiplicative model. The homozygote relative risk is
|
coverage |
A single finite integer greater than or equal to 2. Common fixed-depth shorthand for the father, mother, and affected child. It may be omitted when all three member-specific depths are supplied. |
seq_error |
A single finite symmetric per-read sequencing-error
probability in |
alpha |
A single finite significance level in |
verbose |
Logical scalar. If |
father_coverage, mother_coverage, child_coverage
|
Optional fixed depths
for each trio member. An explicitly supplied member depth overrides
|
epsilon0 |
Directional probability that a reference-allele read is
observed as the alternative allele. Defaults to |
epsilon1 |
Directional probability that an alternative-allele read is
observed as the reference allele. Defaults to |
pheno_misclass |
Logical scalar. If |
prev |
Disease prevalence in |
pi01 |
Probability that an unaffected individual is misclassified or
ascertained as affected, in |
locus_het |
Logical scalar. If |
heter_rate |
Heterogeneous trio fraction in |
TDT1-NGS is evaluated for one biallelic variant under Hardy-Weinberg
parental genotype frequencies, random mating, a multiplicative disease
model, fixed member-specific coverage, and common directional sequencing
error. With
, the transmission parameter is
and .
Kim's Appendix B noncentrality parameter is
where is the nuisance-adjusted per-trio information evaluated
under the null from raw sequencing read-count probabilities and the 15
latent Mendelian trio states. Power is the upper-tail probability beyond
the central one-degree-of-freedom chi-square critical value under a
noncentral chi-square distribution with NCP .
When requested, phenotype misclassification is a sensitivity bridge rather
than a phenotype-aware sequencing likelihood. Let
be the ordinary-TDT per-trio NCP
coefficient. The bridge computes
from the ordinary-TDT expected transmission and nontransmission
probabilities, using the fixed assumptions ,
, and . It then reports
. Kim's raw-read likelihood,
information matrix, and efficient information remain unchanged.
Locus heterogeneity uses the analogous independent bridge
The ordinary-TDT expected counts are evaluated at one trio using
for the homogeneous reference and
heter_rate for the requested sensitivity scenario.
It uses the same fixed , , and
assumptions as the phenotype bridge. If both modifiers are requested, they
are reported separately against the same sequencing-only baseline; their
factors are never multiplied and no combined result is calculated.
The existing directional read model is
for genotype . Thus ,
, and
; the heterozygote probability is
one-half in the symmetric case. The effective errors must be nonnegative
and sum to less than one.
Coverage 1 is unsupported under the full published nuisance model. Its eight observable read-count triples provide at most seven independent probability dimensions for an 11-parameter information model, so efficient information is not identifiable without changing the model or using a generalized inverse.
This prospective calculation performs no simulation or EM fitting. It does not implement TDT2-NGS, conventional genotype misclassification/TDTae, a joint modifier likelihood, or multi-locus testing. Coverage is fixed for each member rather than random or sample-specific.
Invisibly, an object of class "tdt_ngs_power" containing the
design inputs, power and NCP, multiplicative-model parameters, efficient
information, the 11 by 11 information matrix, compact numerical
diagnostics, effective member-specific coverage and directional-error
metadata, model metadata, and a scenarios list that always contains
sequencing_only and, when requested,
phenotype_misclassification and heterogeneity. Modifier
scenarios record their ordinary-TDT bridge inputs, coefficients,
attenuation factor, and confirmation that the raw-read likelihood was not
modified. Legacy coverage and seq_error fields retain the
supplied common shorthand values.
Kim, W. (2015). Transmission disequilibrium tests based on read counts for low-coverage next-generation sequence data. Human Heredity, 80(1), 36–49. doi:10.1159/000434645.
Buyske, S., Yang, G., Matise, T. C., & Gordon, D. (2009). When a case is not a case: Effects of phenotype misclassification on power and sample size requirements for the transmission disequilibrium test with affected child trios. Human Heredity, 67(4), 287–292. doi:10.1159/000194981.
Chen, C., Yang, G., Buyske, S., Matise, T., Finch, S. J., & Gordon, D. (2009). Transmission disequilibrium test power and sample size in the presence of locus heterogeneity. Statistical Applications in Genetics and Molecular Biology, 8, Article 44. doi:10.2202/1544-6115.1501.
Gordon, D., Finch, S. J., & Kim, W. (2020). Heterogeneity in Statistical Genetics: How to Assess, Address, and Account for Mixtures in Association Studies. Springer. doi:10.1007/978-3-030-61121-7.
tdt_ngs_power( N = 5000, pd = 0.325, R1 = 1.2, coverage = 12, seq_error = 0.005, alpha = 5e-8, verbose = FALSE ) tdt_ngs_power( N = 5000, pd = 0.325, R1 = 1.2, coverage = 12, seq_error = 0.005, locus_het = TRUE, prev = 0.01, heter_rate = 0.25, alpha = 5e-8, verbose = FALSE ) tdt_ngs_power( N = 5000, pd = 0.325, R1 = 1.2, coverage = 12, seq_error = 0.005, pheno_misclass = TRUE, prev = 0.01, pi01 = 0.05, alpha = 5e-8, verbose = FALSE )tdt_ngs_power( N = 5000, pd = 0.325, R1 = 1.2, coverage = 12, seq_error = 0.005, alpha = 5e-8, verbose = FALSE ) tdt_ngs_power( N = 5000, pd = 0.325, R1 = 1.2, coverage = 12, seq_error = 0.005, locus_het = TRUE, prev = 0.01, heter_rate = 0.25, alpha = 5e-8, verbose = FALSE ) tdt_ngs_power( N = 5000, pd = 0.325, R1 = 1.2, coverage = 12, seq_error = 0.005, pheno_misclass = TRUE, prev = 0.01, pi01 = 0.05, alpha = 5e-8, verbose = FALSE )
Computes power for the transmission disequilibrium test (TDT) at a fixed
number of affected trios with no effect or one selected effect: phenotype
misclassification, locus heterogeneity, or genotype misclassification.
input_mode lets the transmission probabilities come either from a
genetic model ("model_based", the default) or directly from
user-supplied expected transmission and non-transmission counts
("model_free").
tdt_power( N, input_mode = c("model_based", "model_free"), pd = NULL, prev = NULL, R1 = NULL, R2 = NULL, alpha = 0.05, delta_prime = 1, misclass_rate = 0, heter_rate = 0, ET = NULL, ENT = NULL, verbose = TRUE, effect = c("none", "phenotype_misclassification", "locus_heterogeneity", "genotype_misclassification"), genotype_misclassification_rate = NULL )tdt_power( N, input_mode = c("model_based", "model_free"), pd = NULL, prev = NULL, R1 = NULL, R2 = NULL, alpha = 0.05, delta_prime = 1, misclass_rate = 0, heter_rate = 0, ET = NULL, ENT = NULL, verbose = TRUE, effect = c("none", "phenotype_misclassification", "locus_heterogeneity", "genotype_misclassification"), genotype_misclassification_rate = NULL )
N |
Numeric |
input_mode |
Character. One of |
pd |
Numeric in (0,1). Frequency of the disease/high-risk allele at
the marker locus. Required for |
prev |
Numeric in (0,1). Disease prevalence ( |
R1 |
Numeric |
R2 |
Numeric |
alpha |
Numeric in (0,1). Significance level for the TDT
(default |
delta_prime |
Numeric. Linkage disequilibrium scale parameter
|
misclass_rate |
Numeric in |
heter_rate |
Numeric in |
ET, ENT
|
Numeric |
verbose |
Logical. If |
effect |
Character. Optional explicit effect selector: |
genotype_misclassification_rate |
Numeric in |
With input_mode = "model_based", penetrances
are derived
from prev, R1, R2, and pd, and the expected
transmission and non-transmission probabilities under each of the three
scenarios are computed from the standard TDT formulation in Eq. 1.25
(Chapter 1, Section 1.6.1.3, p. 27), the phenotype-misclassification
probabilities in Eqs. 5.24–5.27 (Section 5.2.6, pp. 284–285), and the
locus-heterogeneity construction in Eqs. 5.30–5.34a (Section 5.3.3,
pp. 293–294) of Gordon, Finch, and Kim (2020). Eq. 5.28 is a numerical
worked example, not the general symbolic formula.
Phenotype misclassification and locus heterogeneity are reported as
separate sensitivity scenarios; supplying both rates does not create a
combined-error scenario.
N is the number of affected-child trios, with both parents genotyped.
ET and ENT are expected counts accumulated over trios, whereas
and are per-parental-allele transmission and
non-transmission probabilities. heter_rate is the heterogeneous
fraction; in lower-level formulas written with the linked/homogeneous
fraction ; equivalently, the heterogeneous fraction is
.
With input_mode = "model_free", the no-error scenario uses
and directly. The
misclassification and heterogeneity scenarios are then computed from the
following identities, which are algebraically equivalent to the
the corresponding model-based identities. Let
(no-error) and
:
A scenario is only computed from these identities when its rate is
non-zero; at a rate of exactly 0 the scenario reuses the no-error
/ directly, so pd is not required unless at
least one rate is non-zero, and prev is not required unless
misclass_rate is non-zero.
If pd is needed but not supplied, it is solved from ET and
ENT via . This
quadratic has two roots summing to ; the root in
is used, with a message reporting the derived value. An error is raised if
no such unique root exists – supplying pd directly is preferred.
The genotype-misclassification effect implements the Chapter 5
single-parameter adjacent-genotype TDT model in Section 5.2.5:
and
. The independent
member transitions are applied to the 15 true Mendelian-consistent trios,
producing 27 observed configurations (Eqs. 5.18–5.20). Observed
Mendelian-inconsistent trios are removed and the retained probabilities are
renormalized (Eqs. 5.16–5.17); expected transmitted and non-transmitted
counts and the NCP then follow Eqs. 5.22 and 5.21. This branch requires
model-based input and cannot be combined with phenotype misclassification or
locus heterogeneity. Only this Chapter 5 single-parameter adjacent-genotype
TDT model is supported: TDTae and sequencing/NGS genotype error are not
implemented.
Power uses the package's existing nominal asymptotic chi-square threshold;
conventional genotype error can inflate the ordinary TDT Type-I error.
An object of class "tdt_power", containing:
Significance level, affected-trio count, and input mode.
Named no_error, misclassification, and
heterogeneity NCP and power values.
Absolute power loss for each modifier relative to the no-error scenario.
Scenario-specific transmission and non-transmission probabilities.
Scenario-specific expected transmission and
non-transmission counts for the supplied N trios.
Supplied and derived genetic-model, LD, misclassification, and heterogeneity parameters.
Spielman, R. S., McGinnis, R. E., & Ewens, W. J. (1993). Transmission test for linkage disequilibrium: the insulin gene region and insulin-dependent diabetes mellitus. American Journal of Human Genetics, 52(3), 506–516. PMID: 8447318; PMCID: PMC1682161.
Gordon, D., Finch, S. J., & Kim, W. (2020). Heterogeneity in Statistical Genetics: How to Assess, Address, and Account for Mixtures in Association Studies. Springer. doi:10.1007/978-3-030-61121-7.
Buyske, S., Yang, G., Matise, T. C., & Gordon, D. (2009). When a case is not a case: Effects of phenotype misclassification on power and sample size requirements for the transmission disequilibrium test with affected child trios. Human Heredity, 67(4), 287–292. doi:10.1159/000194981.
Chen, C., Yang, G., Buyske, S., Matise, T., Finch, S. J., & Gordon, D. (2009). Transmission disequilibrium test power and sample size in the presence of locus heterogeneity. Statistical Applications in Genetics and Molecular Biology, 8, Article 44. doi:10.2202/1544-6115.1501.
tdt_mssn for the MSSN counterpart.
# Model-based input tdt_power( N = 600, input_mode = "model_based", pd = 0.30, prev = 0.05, R1 = 1.5, R2 = 2.25, misclass_rate = 0.01, heter_rate = 0.10, verbose = FALSE )$power$no_error # Chapter 5 single-parameter adjacent-genotype TDT error tdt_power( N = 600, pd = 0.30, prev = 0.05, R1 = 1.5, R2 = 2.25, effect = "genotype_misclassification", genotype_misclassification_rate = 0.01, verbose = FALSE )$power$genotype_misclassification # model_free: supply expected transmissions/non-transmissions directly tdt_power( N = 600, input_mode = "model_free", ET = 140, ENT = 100, pd = 0.30, prev = 0.05, misclass_rate = 0.01, heter_rate = 0.10, verbose = FALSE )$power$no_error# Model-based input tdt_power( N = 600, input_mode = "model_based", pd = 0.30, prev = 0.05, R1 = 1.5, R2 = 2.25, misclass_rate = 0.01, heter_rate = 0.10, verbose = FALSE )$power$no_error # Chapter 5 single-parameter adjacent-genotype TDT error tdt_power( N = 600, pd = 0.30, prev = 0.05, R1 = 1.5, R2 = 2.25, effect = "genotype_misclassification", genotype_misclassification_rate = 0.01, verbose = FALSE )$power$genotype_misclassification # model_free: supply expected transmissions/non-transmissions directly tdt_power( N = 600, input_mode = "model_free", ET = 140, ENT = 100, pd = 0.30, prev = 0.05, misclass_rate = 0.01, heter_rate = 0.10, verbose = FALSE )$power$no_error
Computes the statistical power of the Transmission Disequilibrium Test (TDT) given the expected number of transmissions (ET) and non-transmissions (ENT) under a specified significance level. Implements Eq. 1.25 (Chapter 1, Section 1.6.1.3, p. 27) of Gordon, Finch, and Kim (2020).
tdt_power_from_expected_counts(ET, ENT, alpha = 0.05)tdt_power_from_expected_counts(ET, ENT, alpha = 0.05)
ET |
Numeric. Expected number of transmissions. |
ENT |
Numeric. Expected number of non-transmissions. |
alpha |
Numeric. Significance level (default = 0.05). |
The function calculates the non-centrality parameter and statistical power for the TDT
using the chi-square distribution with 1 degree of freedom.
ET and ENT are expected counts, not probabilities, and must
refer to the same affected-trio design.
The non-centrality parameter is computed as:
Power is then obtained as:
A list containing:
lambda |
Non-centrality parameter. |
power |
Computed power at the given alpha level. |
ET |
Expected transmissions. |
ENT |
Expected non-transmissions. |
Spielman, R. S., McGinnis, R. E., & Ewens, W. J. (1993). Transmission test for linkage disequilibrium: the insulin gene region and insulin-dependent diabetes mellitus. American Journal of Human Genetics, 52(3), 506–516. PMID: 8447318; PMCID: PMC1682161.
Gordon, D., Finch, S. J., & Kim, W. (2020). Heterogeneity in Statistical Genetics: How to Assess, Address, and Account for Mixtures in Association Studies. Springer. doi:10.1007/978-3-030-61121-7.
tdt_power and tdt_power_from_model.
# Example: compute power for ET = 140 and ENT = 100 tdt_power_from_expected_counts(ET = 140, ENT = 100, alpha = 0.05)# Example: compute power for ET = 140 and ENT = 100 tdt_power_from_expected_counts(ET = 140, ENT = 100, alpha = 0.05)
Computes the statistical power of the Transmission Disequilibrium Test (TDT) using genetic model parameters such as allele frequency, relative risks, disease prevalence, and the number of affected trios. Implements the penetrance construction in Eqs. 1.6–1.7 (p. 13) and TDT Eq. 1.25 (p. 27) of Gordon, Finch, and Kim (2020).
tdt_power_from_model( pd, N, delta_prime, f0 = NULL, f1 = NULL, f2 = NULL, prev = NULL, R1 = NULL, R2 = NULL, alpha = 0.05 )tdt_power_from_model( pd, N, delta_prime, f0 = NULL, f1 = NULL, f2 = NULL, prev = NULL, R1 = NULL, R2 = NULL, alpha = 0.05 )
pd |
Numeric. Frequency of the disease-associated allele. |
N |
Numeric. Number of affected trios. |
delta_prime |
Numeric. Linkage disequilibrium (LD) scale factor (default = 1). |
f0, f1, f2
|
Optional. Penetrances for genotypes with 0, 1, and 2 risk alleles.
If not provided, they are computed internally using |
prev |
Numeric. Disease prevalence. |
R1 |
Numeric. Relative risk for heterozygotes. |
R2 |
Numeric. Relative risk for homozygotes. |
alpha |
Numeric. Significance level (default = 0.05). |
When penetrances (f0, f1, f2) are not provided, they are
derived from the model parameters using:
where
Expected transmission () and non-transmission () counts are
computed based on the allele frequency and penetrance model, and the power
is derived from the non-central chi-square distribution with 1 degree of freedom.
Here N is the number of affected-child trios. delta_prime
scales in the implemented model; the disease-locus and
marker-locus assumptions should be considered when interpreting pd.
A list containing:
lambda |
Non-centrality parameter. |
power |
Computed power at the given significance level. |
ET |
Expected transmissions. |
ENT |
Expected non-transmissions. |
Penetrances |
Vector of computed penetrances (f0, f1, f2). |
Spielman, R. S., McGinnis, R. E., & Ewens, W. J. (1993). Transmission test for linkage disequilibrium: the insulin gene region and insulin-dependent diabetes mellitus. American Journal of Human Genetics, 52(3), 506–516. PMID: 8447318; PMCID: PMC1682161.
Gordon, D., Finch, S. J., & Kim, W. (2020). Heterogeneity in Statistical Genetics: How to Assess, Address, and Account for Mixtures in Association Studies. Springer. doi:10.1007/978-3-030-61121-7.
tdt_power,
tdt_power_from_expected_counts, and
tdt_mssn_from_model.
# Example: model-based power computation tdt_power_from_model( pd = 0.25, N = 10000, delta_prime = 1, prev = 0.05, R1 = 1, R2 = 1.1, alpha = 0.05 )# Example: model-based power computation tdt_power_from_model( pd = 0.25, N = 10000, delta_prime = 1, prev = 0.05, R1 = 1, R2 = 1.1, alpha = 0.05 )