Skip to content

The transmission disequilibrium test

A family-based association test that counts which allele heterozygous parents pass on to affected children, which protects it from population stratification.

Advanced ~11 min9 steps

What runs in CodeSplash

You will be able to

  • Explain why a family design resists population stratification
  • Identify which parents are informative
  • Compute the TDT statistic and read its exact counterpart

Read first

01

A confounder in the sample

Read

Suppose you compare cases and controls for an allele. If your sample mixes groups whose allele frequencies and disease rates both differ, the allele can look linked to disease with no biological connection. That's population stratificationPopulation stratificationConfounding that arises when subgroups differ in both allele frequency and outcome rate..

Families offer a way around it. A heterozygous parent passes on either allele by a coin flip, whatever group they belong to.

The numbers below are the guide's validated outputs, not recorded engine runs. The last step runs the test in CodeSplash.

02

Who counts?

Predict

Predict first

You have trios: two parents and one affected child. You want to see whether allele AA is passed on more often than chance.

Which parents can tell you anything?

Every parentOnly heterozygous parentsOnly homozygous parents
Reveal

Only heterozygous parents. A parent with two copies of the same allele has no choice about which one to pass on, so they add no information. Don't count them as transmissions.

03

The test

Read

From the informative parents, count bb, the transmissions of the tested allele, and cc, the times it wasn't transmitted. If there is no linkage and association, each is a coin flip:

X2=(b−c)2b+c,B∣(b+c)∼Binomial(b+c,12)X^2 = \frac{(b - c)^2}{b + c}, \qquad B \mid (b + c) \sim \text{Binomial}\left(b + c, \tfrac{1}{2}\right)

The TDTTransmission disequilibrium testCounts which allele heterozygous parents pass to affected children and compares the two counts. is McNemar's test applied to transmissions.

04

The guide's example

Predict

Predict first

The guide's example has b=30b = 30 and c=18c = 18. What is X2X^2?

Make your guess between 0 and 10 X², then reveal.

Reveal

X2=(30−18)2/48=144/48=3X^2 = (30 - 18)^2 / 48 = 144/48 = 3. Its validated p-value is .083.083. The exact binomial test gives .111.111.

TDT = 3.00, p = 0.0833
Exact binomial test: 30 of 48, p = 0.1114
95 percent confidence interval: 0.4735 to 0.7605
Sample estimate of the transmission probability: 0.625

The interval includes 0.50.5, so these counts are compatible with no excess transmission, and also with a sizeable one.

05

Move the counts

Explore

Change the two rates and the number of parents below. How many parents does it take before a gap like the starting one reliably stands out?

BExplorable · Transmission disequilibrium test

Do heterozygous parents transmit one allele more often than the other?

120
0.24
0.14
0.050

Your data

Edit the counts
After: yesAfter: noTotal
Before: yes
36E = 29.7
30E = 36.3
66
Before: no
18E = 24.3
36E = 29.7
54
Total5466120

E is the count expected if rows and columns were unrelated.

If H₀ were true

χ² = 3.00
  1. The reference: how χ² varies across samples when H₀ is true (χ² approximation).
  2. Your statistic, from the data above.
  3. The p-value: the area at least as extreme as yours (p = .083).
  4. The hatched rejection region at α = .050: statistics landing here reject H₀.

The formula

χTDT2=(b−c)2b+c∼χ12\chi^2_{TDT} = \dfrac{(b-c)^2}{b+c}\sim\chi^2_1

With your numbers

χTDT2=(30−18)230+18=3\chi^2_{TDT} = \dfrac{(30-18)^2}{30+18} = 3
b, cb,\ c
transmissions of allele 1 vs. allele 2 from heterozygous parents

The verdict

χ²(1) = 3.00, p = .083

p > α = .050: compatible with H₀

McNemar's test on transmissions: family-based, so population stratification cannot create a false association.

Statistic
3.000
p-value
0.0833
Transmission disequilibrium test on a 2 × 2 table of 120 counts: χ²(1) = 3.00, p = .083. The p-value is above α = .050, so the data are compatible with H0.

Transmission disequilibrium test on a 2 × 2 table of 120 counts: χ²(1) = 3.00, p = .083. The p-value is above α = .050, so the data are compatible with H₀.

06

What it protects you from

Reflect

The coin flip is the protection: within a parent, which allele is passed on doesn't depend on ancestry.

It doesn't fix everything. Two affected siblings share parents, so their transmissions aren't independent. Genotyping errors can create false transmissions, particularly when a parent is miscalled.

For a family study you might run, which of those two would worry you most, and why?

07

Check your understanding

Checkpoint

Check yourself

Compute the TDT statistic for b=40b = 40, c=20c = 20. Give two decimals.

Show the answer

Answer: 6.67

(40−20)2/60=400/60≈6.67(40 - 20)^2/60 = 400/60 \approx 6.67.

Check yourself

Why does the TDT resist population stratification?

Show the answer

Answer: c

Each transmission is its own within-parent comparison, so differences in allele frequency between groups don't enter.

Check yourself

A family has three affected children. Can you treat all their transmissions from one parent as independent for the usual chi-square?

Show the answer

Answer: b

The guide warns that not every family member provides an independent transmission. Extensions exist for larger families.

08

Run it in CodeSplash

In the app

The TDT is a CodeSplash method, Transmission disequilibrium test (TDT). Run the guide's exact-test example here, or open it as a notebook or in the Genetics studio to use your own counts. Genetics methods aren't in Analyze's list.

Transmission disequilibrium testRecorded · Python and R agreeRecorded 2026-11-17 · 29 values compared
R

exact TDT, b = 30, c = 18, p = .111, OR = 1.67

Transmissions of tested (b)
30
Transmissions of other (c)
18
b
30
p (exact TDT)
.111

Effect size

  • Transmission odds ratio b/c 1.667 95% CI [0.9291, 2.990]
  • Share of transmissions that carry tested 0.6250 95% CI [0.4735, 0.7605]

Assumptions

  • Mendelian transmission — Counts were given directly, so this isn't checkable.
  • Enough informative parents — b + c = 48 informative transmissions.
  • Independent transmissions — Use one affected child per family; extra siblings' transmissions aren't independent.
  • Reliable genotype calls — Calling errors create false transmissions; check Mendelian errors and call rates first.

Transmissions from heterozygous parents

AlleleTransmittedNot transmitted
tested3018
other1830

All the tests of these counts

TestStatisticp
McNemar χ²30.0833
McNemar χ², continuity-corrected2.5210.1124
Exact binomial, two-sided—0.1114
Exact binomial, mid-p—0.0854
Exact, tested over-transmitted—0.0557
Exact, tested under-transmitted—0.9703
  • Research use only: not for clinical or diagnostic decisions. Genotypes are personal data.
  • Only heterozygous parents are informative: homozygous parents transmit the same allele whichever copy they pass on.
  • Within-family comparison protects against population stratification, but not against genotyping error or biased ascertainment.
The exact R script · R R version 4.5.1 (2025-06-13)
# Transmission disequilibrium test (TDT)
# Generated by CodeSplash Analytics 1.0.0 on 2026-11-09 · method genetics.tdt 1.0.1 · spec 0543d53845218ec8
# Dataset: ge_tdt_counts (version 1)
# Runs on its own: outside the app, cs_publish() writes $CS_RESULT_PATH or prints the result JSON.

# %% Setup
library(codesplashr) # cs_gen_tdt_trios, cs_gen_tdt_counts (Spielman et al. 1993; twins of codesplash.stats.genetics)

# %% Data (no rows dropped here: genotype no-calls and missing values are handled by the analysis)
df <- as.data.frame(nanoparquet::read_parquet("tests/parity/fixtures/ge_tdt_counts.parquet", col_select = c("transmitted", "untransmitted")))
n_input <- nrow(df)
warnings <- list()
research_note <- "Research use only: not for clinical or diagnostic decisions. Genotypes are personal data."

# %% Transmissions
trio_roles <- c(NULL, NULL, NULL)
count_roles <- c("transmitted", "untransmitted")
test <- "exact"
continuity <- FALSE
alternative <- "two_sided"
conf <- 0.95
if (length(trio_roles) == 3) {
  input_kind <- "trios"
  t <- cs_gen_tdt_trios(df[[trio_roles[1]]], df[[trio_roles[2]]], df[[trio_roles[3]]])
  b <- t$b
  c <- t$c
  allele_a <- t$allele_a
  allele_b <- t$allele_b
  if (t$n_missing > 0) warnings <- c(warnings, sprintf("%d trios had a no-call and were left out.", as.integer(t$n_missing)))
  if (t$n_mendel > 0) warnings <- c(warnings, sprintf("%d trios break Mendelian inheritance (a calling or pedigree error) and were left out.", as.integer(t$n_mendel)))
} else if (length(count_roles) == 2 && length(trio_roles) == 0) {
  input_kind <- "counts"
  tb <- as.numeric(df[[count_roles[1]]])
  tc <- as.numeric(df[[count_roles[2]]])
  ok <- !(is.na(tb) | is.na(tc))
  if (sum(!ok) > 0) warnings <- c(warnings, sprintf("%d rows had a missing count and were left out.", sum(!ok)))
  if (!any(ok)) cs_error("CS_E_NO_ROWS")
  cs_check_finite_columns(df[ok, , drop = FALSE], count_roles)  # infinite values stop the run (registry/errors.yaml)
  b <- sum(tb[ok])
  c <- sum(tc[ok])
  if (b != floor(b) || c != floor(c) || b < 0 || c < 0) stop("Transmission counts must be whole numbers of at least 0.", call. = FALSE)
  t <- list(n_trios = NA, n_used = NA, n_missing = NA, n_mendel = NA, n_uninformative = NA, n_het_parents = NA)
  allele_a <- "other"
  allele_b <- "tested"
} else {
  stop("Bind the child, father and mother genotypes (one row per trio), or the transmitted and not-transmitted counts.", call. = FALSE)
}

# %% Tests
r <- cs_gen_tdt_counts(b, c, conf)
m <- r$n_informative
if (test == "chisq") {
  stat <- if (continuity) r$tdt_cc else r$tdt
  p <- if (continuity) r$p_chisq_cc else r$p_chisq
  label <- paste0("TDT (McNemar χ²", if (continuity) ", continuity-corrected)" else ")")
} else {
  stat <- b
  p <- switch(alternative, two_sided = r$p_exact, greater = r$p_exact_greater, less = r$p_exact_less)
  label <- paste0("exact TDT", if (alternative == "two_sided") "" else ", one-sided")
}

# %% Assumptions
small <- m < 10
mendel_status <- if (input_kind == "trios") (if (t$n_mendel > 0) "warn" else "pass") else "info"
mendel_detail <- if (input_kind == "trios") {
  if (t$n_mendel > 0) sprintf("%d of %d trios break Mendelian inheritance and were left out.", as.integer(t$n_mendel), as.integer(t$n_trios)) else
    "Every complete trio is consistent with Mendelian inheritance."
} else "Counts were given directly, so this isn't checkable."
assumptions <- list(
  list(key = "mendelian", label = "Mendelian transmission", status = mendel_status, detail = mendel_detail),
  list(key = "informative", label = "Enough informative parents", status = if (small) (if (test == "exact") "info" else "warn") else "pass",
       detail = paste0(sprintf("b + c = %d informative transmissions", as.integer(m)),
                       if (small && test == "exact") "; the exact test doesn't need many." else if (small) "; use the exact test." else ".")),
  list(key = "independence", label = "Independent transmissions", status = "info", detail = "Use one affected child per family; extra siblings' transmissions aren't independent."),
  list(key = "genotype_quality", label = "Reliable genotype calls", status = "info", detail = "Calling errors create false transmissions; check Mendelian errors and call rates first.")
)

# %% Result
summary <- sprintf("Heterozygous parents transmitted %s %s times and %s %s times (proportion %.3f, %.0f%% CI %.3f to %.3f): %s, %s.",
                   allele_b, format(b), allele_a, format(c), r$transmission, 100 * conf, r$transmission_low, r$transmission_high, label, cs_fmt_p(p))
apa <- paste0(if (test == "chisq") sprintf("TDT χ²(1, N = %d) = %s, %s", as.integer(m), cs_fmt_num(stat), cs_fmt_p(p)) else
  sprintf("exact TDT, b = %s, c = %s, %s", format(b), format(c), cs_fmt_p(p)),
  if (is.finite(r$odds_ratio)) sprintf(", OR = %s", cs_fmt_num(r$odds_ratio)) else "")
tests <- list(
  list(test = "McNemar χ²", statistic = r$tdt, p = r$p_chisq),
  list(test = "McNemar χ², continuity-corrected", statistic = r$tdt_cc, p = r$p_chisq_cc),
  list(test = "Exact binomial, two-sided", statistic = NA, p = r$p_exact),
  list(test = "Exact binomial, mid-p", statistic = NA, p = r$p_midp),
  list(test = sprintf("Exact, %s over-transmitted", allele_b), statistic = NA, p = r$p_exact_greater),
  list(test = sprintf("Exact, %s under-transmitted", allele_b), statistic = NA, p = r$p_exact_less)
)
counts <- list(list(allele = allele_b, transmitted = b, not_transmitted = c), list(allele = allele_a, transmitted = c, not_transmitted = b))
notes <- list(research_note, "Only heterozygous parents are informative: homozygous parents transmit the same allele whichever copy they pass on.",
              "Within-family comparison protects against population stratification, but not against genotyping error or biased ascertainment.")
result_values <- c(
  r[c("b", "c", "n_informative", "tdt", "tdt_cc", "p_chisq", "p_chisq_cc", "p_exact", "p_midp", "p_exact_greater",
      "p_exact_less", "transmission", "transmission_low", "transmission_high", "odds_ratio", "or_low", "or_high")],
  list(p = p, statistic = stat, test = test, input = input_kind, allele_a = allele_a, allele_b = allele_b),
  t[c("n_trios", "n_used", "n_missing", "n_mendel", "n_uninformative", "n_het_parents")]
)
cs_publish(list(
  method = "genetics.tdt",
  methodVersion = "1.0.1",
  title = "Transmission disequilibrium test",
  engine = cs_engine_info("stats", "nanoparquet"),
  n = m,
  summary = summary,
  apa = apa,
  statistics = list(
    list(key = "b", label = sprintf("Transmissions of %s (b)", allele_b), value = b),
    list(key = "c", label = sprintf("Transmissions of %s (c)", allele_a), value = c),
    list(key = "statistic", label = if (test == "chisq") "χ²" else "b", value = stat),
    list(key = "p", label = sprintf("p (%s)", label), value = p, format = "p")
  ),
  tables = list(
    list(key = "counts", title = "Transmissions from heterozygous parents",
         columns = list(list(key = "allele", label = "Allele", type = "string"), list(key = "transmitted", label = "Transmitted", type = "integer"),
                        list(key = "not_transmitted", label = "Not transmitted", type = "integer")),
         rows = counts),
    list(key = "tests", title = "All the tests of these counts",
         columns = list(list(key = "test", label = "Test", type = "string"), list(key = "statistic", label = "Statistic", type = "number"), list(key = "p", label = "p", type = "p")),
         rows = tests)
  ),
  effectSizes = list(
    list(key = "odds_ratio", label = "Transmission odds ratio b/c", value = r$odds_ratio, ciLow = r$or_low, ciHigh = r$or_high, ciLevel = conf, method = "Wald interval on log(b/c)"),
    list(key = "transmission", label = sprintf("Share of transmissions that carry %s", allele_b), value = r$transmission, ciLow = r$transmission_low,
         ciHigh = r$transmission_high, ciLevel = conf, method = "Clopper–Pearson")
  ),
  assumptions = assumptions,
  warnings = warnings,
  notes = notes,
  charts = list(),
  values = result_values
))
Python

exact TDT, b = 30, c = 18, p = .111, OR = 1.67

Transmissions of tested (b)
30
Transmissions of other (c)
18
b
30
p (exact TDT)
.111

Effect size

  • Transmission odds ratio b/c 1.667 95% CI [0.9291, 2.990]
  • Share of transmissions that carry tested 0.6250 95% CI [0.4735, 0.7605]

Assumptions

  • Mendelian transmission — Counts were given directly, so this isn't checkable.
  • Enough informative parents — b + c = 48 informative transmissions.
  • Independent transmissions — Use one affected child per family; extra siblings' transmissions aren't independent.
  • Reliable genotype calls — Calling errors create false transmissions; check Mendelian errors and call rates first.

Transmissions from heterozygous parents

AlleleTransmittedNot transmitted
tested3018
other1830

All the tests of these counts

TestStatisticp
McNemar χ²30.0833
McNemar χ², continuity-corrected2.5210.1124
Exact binomial, two-sided—0.1114
Exact binomial, mid-p—0.0854
Exact, tested over-transmitted—0.0557
Exact, tested under-transmitted—0.9703
  • Research use only: not for clinical or diagnostic decisions. Genotypes are personal data.
  • Only heterozygous parents are informative: homozygous parents transmit the same allele whichever copy they pass on.
  • Within-family comparison protects against population stratification, but not against genotyping error or biased ascertainment.
The exact Python script · Python Python 3.13.5 · scipy 1.18.1 · pandas 3.1.0
# Transmission disequilibrium test (TDT)
# Generated by CodeSplash Analytics 1.0.0 on 2026-11-09 · method genetics.tdt 1.0.1 · spec 0543d53845218ec8
# Dataset: ge_tdt_counts (version 1)
# Runs on its own: outside the app, cs.publish() writes $CS_RESULT_PATH or prints the result JSON.

# %% Setup
import math

import numpy as np
import pandas as pd

import codesplash as cs
from codesplash.stats import genetics as gen  # TDT from trios or counts (Spielman et al. 1993; twins of cs_gen_tdt_*)

# %% Data (no rows dropped here: genotype no-calls and missing values are handled by the analysis)
df = pd.read_parquet("tests/parity/fixtures/ge_tdt_counts.parquet", columns=["transmitted", "untransmitted"])
n_input = len(df)
warnings = []
research_note = "Research use only: not for clinical or diagnostic decisions. Genotypes are personal data."

# %% Transmissions
trio_roles = [None, None, None]
count_roles = ["transmitted", "untransmitted"]
test = "exact"
continuity = False
alternative = "two_sided"
conf = float(0.95)
if all(trio_roles):
    input_kind = "trios"
    t = gen.tdt_trios(df[trio_roles[0]].to_numpy(), df[trio_roles[1]].to_numpy(), df[trio_roles[2]].to_numpy())
    b, c = t["b"], t["c"]
    allele_a, allele_b = t["allele_a"], t["allele_b"]
    if t["n_missing"]:
        warnings.append(f"{t['n_missing']} trios had a no-call and were left out.")
    if t["n_mendel"]:
        warnings.append(f"{t['n_mendel']} trios break Mendelian inheritance (a calling or pedigree error) and were left out.")
elif all(count_roles) and not any(trio_roles):
    input_kind = "counts"
    tb = df[count_roles[0]].to_numpy(dtype=float)
    tc = df[count_roles[1]].to_numpy(dtype=float)
    ok = ~(np.isnan(tb) | np.isnan(tc))
    if (~ok).sum():
        warnings.append(f"{int((~ok).sum())} rows had a missing count and were left out.")
    if not ok.any():
        cs.cs_error("CS_E_NO_ROWS")
    cs.check_finite_columns(df[ok], count_roles)  # infinite values stop the run (registry/errors.yaml)
    b, c = float(tb[ok].sum()), float(tc[ok].sum())
    if b != math.floor(b) or c != math.floor(c) or b < 0 or c < 0:
        raise ValueError("Transmission counts must be whole numbers of at least 0.")
    t = {"n_trios": None, "n_used": None, "n_missing": None, "n_mendel": None, "n_uninformative": None, "n_het_parents": None}
    allele_a, allele_b = "other", "tested"
else:
    raise ValueError("Bind the child, father and mother genotypes (one row per trio), or the transmitted and not-transmitted counts.")

# %% Tests
r = gen.tdt_counts(b, c, conf)
m = r["n_informative"]
if test == "chisq":
    stat = r["tdt_cc"] if continuity else r["tdt"]
    p = r["p_chisq_cc"] if continuity else r["p_chisq"]
    label = "TDT (McNemar χ²" + (", continuity-corrected)" if continuity else ")")
else:
    stat = b
    p = {"two_sided": r["p_exact"], "greater": r["p_exact_greater"], "less": r["p_exact_less"]}[alternative]
    label = "exact TDT" + ("" if alternative == "two_sided" else ", one-sided")

# %% Assumptions
small = m < 10
assumptions = [
    {"key": "mendelian", "label": "Mendelian transmission", "status": ("warn" if t["n_mendel"] else "pass") if input_kind == "trios" else "info",
     "detail": (f"{t['n_mendel']} of {t['n_trios']} trios break Mendelian inheritance and were left out." if t["n_mendel"]
                else "Every complete trio is consistent with Mendelian inheritance.") if input_kind == "trios" else "Counts were given directly, so this isn't checkable."},
    {"key": "informative", "label": "Enough informative parents", "status": ("info" if test == "exact" else "warn") if small else "pass",
     "detail": f"b + c = {int(m)} informative transmissions" + ("; the exact test doesn't need many." if small and test == "exact" else "; use the exact test." if small else ".")},
    {"key": "independence", "label": "Independent transmissions", "status": "info", "detail": "Use one affected child per family; extra siblings' transmissions aren't independent."},
    {"key": "genotype_quality", "label": "Reliable genotype calls", "status": "info", "detail": "Calling errors create false transmissions; check Mendelian errors and call rates first."},
]

# %% Result
summary = (f"Heterozygous parents transmitted {allele_b} {b:g} times and {allele_a} {c:g} times "
           f"(proportion {r['transmission']:.3f}, {conf:.0%} CI {r['transmission_low']:.3f} to {r['transmission_high']:.3f}): {label}, {cs.fmt_p(p)}.")
apa = (f"TDT χ²(1, N = {int(m)}) = {cs.fmt_num(stat)}, {cs.fmt_p(p)}" if test == "chisq" else f"exact TDT, b = {b:g}, c = {c:g}, {cs.fmt_p(p)}") \
    + (f", OR = {cs.fmt_num(r['odds_ratio'])}" if math.isfinite(r["odds_ratio"]) else "")
tests = [
    {"test": "McNemar χ²", "statistic": r["tdt"], "p": r["p_chisq"]},
    {"test": "McNemar χ², continuity-corrected", "statistic": r["tdt_cc"], "p": r["p_chisq_cc"]},
    {"test": "Exact binomial, two-sided", "statistic": None, "p": r["p_exact"]},
    {"test": "Exact binomial, mid-p", "statistic": None, "p": r["p_midp"]},
    {"test": f"Exact, {allele_b} over-transmitted", "statistic": None, "p": r["p_exact_greater"]},
    {"test": f"Exact, {allele_b} under-transmitted", "statistic": None, "p": r["p_exact_less"]},
]
counts = [{"allele": allele_b, "transmitted": b, "not_transmitted": c}, {"allele": allele_a, "transmitted": c, "not_transmitted": b}]
notes = [research_note, "Only heterozygous parents are informative: homozygous parents transmit the same allele whichever copy they pass on.",
         "Within-family comparison protects against population stratification, but not against genotyping error or biased ascertainment."]
values = {
    **{k: r[k] for k in ("b", "c", "n_informative", "tdt", "tdt_cc", "p_chisq", "p_chisq_cc", "p_exact", "p_midp", "p_exact_greater",
                         "p_exact_less", "transmission", "transmission_low", "transmission_high", "odds_ratio", "or_low", "or_high")},
    "p": p, "statistic": stat, "test": test, "input": input_kind, "allele_a": allele_a, "allele_b": allele_b,
    **{k: t[k] for k in ("n_trios", "n_used", "n_missing", "n_mendel", "n_uninformative", "n_het_parents")},
}
cs.publish({
    "method": "genetics.tdt",
    "methodVersion": "1.0.1",
    "title": "Transmission disequilibrium test",
    "engine": cs.engine_info("pandas", "numpy", "scipy"),
    "n": int(m),
    "summary": summary,
    "apa": apa,
    "statistics": [
        {"key": "b", "label": f"Transmissions of {allele_b} (b)", "value": b},
        {"key": "c", "label": f"Transmissions of {allele_a} (c)", "value": c},
        {"key": "statistic", "label": "χ²" if test == "chisq" else "b", "value": stat},
        {"key": "p", "label": f"p ({label})", "value": p, "format": "p"},
    ],
    "tables": [
        {"key": "counts", "title": "Transmissions from heterozygous parents",
         "columns": [{"key": "allele", "label": "Allele", "type": "string"}, {"key": "transmitted", "label": "Transmitted", "type": "integer"},
                     {"key": "not_transmitted", "label": "Not transmitted", "type": "integer"}],
         "rows": counts},
        {"key": "tests", "title": "All the tests of these counts",
         "columns": [{"key": "test", "label": "Test", "type": "string"}, {"key": "statistic", "label": "Statistic", "type": "number"}, {"key": "p", "label": "p", "type": "p"}],
         "rows": tests},
    ],
    "effectSizes": [
        {"key": "odds_ratio", "label": "Transmission odds ratio b/c", "value": r["odds_ratio"], "ciLow": r["or_low"], "ciHigh": r["or_high"], "ciLevel": conf, "method": "Wald interval on log(b/c)"},
        {"key": "transmission", "label": f"Share of transmissions that carry {allele_b}", "value": r["transmission"], "ciLow": r["transmission_low"],
         "ciHigh": r["transmission_high"], "ciLevel": conf, "method": "Clopper–Pearson"},
    ],
    "assumptions": assumptions,
    "warnings": warnings,
    "notes": notes,
    "charts": [],
    "values": values,
})

This script reproduces it. Replace bb and cc with your counts.

Python
from scipy import stats

b, c = 30, 18
t = (b - c) ** 2 / (b + c)
print(t, stats.chi2.sf(t, 1))
print(stats.binomtest(b, b + c, p=0.5))
R
b <- 30; c <- 18
t <- (b - c)^2 / (b + c)
c(TDT = t, p = pchisq(t, 1, lower.tail = FALSE))
binom.test(b, b + c, p = 0.5)
09

Recap

Recap
  • A heterozygous parent passes on either allele by a coin flip, whatever their ancestry.
  • Only heterozygous parents count, and the statistic is McNemar's on transmissions.
  • Use the exact binomial test when b+cb + c is small.
  • It resists stratification, not genotyping errors or dependent siblings.

Concepts in this lesson