Tutorials › Statistical Genetics › Worked Case-Control Association Calculations

Single-Variant Association Tests · Tutorial 315 of 989

Worked Case-Control Association Calculations

Learn to analyze single-variant case-control tables with additive and categorical logistic models, and to calculate and interpret their odds ratios, uncertainty, and tests.

Intermediate 10 min read

What You'll Learn

  • Translate a case-control genotype table into additive and categorical logistic models
  • Calculate per-allele and genotype-specific odds ratios from fitted coefficients
  • Obtain standard errors and confidence intervals for genotype odds ratios
  • Use Wald statistics to test model coefficients
  • Explain why case-control sampling preserves odds-ratio slopes but not population risks
  • Recognize assumptions and common calculation errors in table-based analyses

Why Work From a Case-Control Table?

A case-control study samples people according to disease status: investigators recruit cases with the disease and controls without it, then compare their genotypes. The resulting table can be analyzed with logistic regression to estimate how genotype is associated with the odds of being a case. A careful calculation must keep three things distinct: the genotype coding, the odds ratio being estimated, and the uncertainty in that estimate.

This tutorial works through both an additive dosage model and a categorical genotype model. The examples use hypothetical counts. In a case-control sample, the fraction of sampled participants who are cases is set by recruitment, so it is not generally the population disease risk. The slopes of the logistic model can nevertheless estimate genotype odds-ratio associations under the sampling conditions described below.

Definition: For a biallelic variant, let \(G\in\{0,1,2\}\) denote the number of copies of the allele whose association is being studied. In a case-control table, each genotype group has a case count and a control count. The genotype-specific case odds in the sampled data are the number of cases divided by the number of controls in that genotype group. An odds ratio compares these odds between genotype groups.

Models and Assumptions

Let \(Y=1\) denote case status and \(Y=0\) denote control status. In the additive dosage model, the log odds of case status is linear in allele count:

$$ \log\left\{\frac{P(Y=1\mid G)}{1-P(Y=1\mid G)}\right\} =\beta_0+\beta_1G. $$

For each additional copy of the allele, the fitted odds are multiplied by \(\exp(\beta_1)\). Thus \(\exp(\beta_1)\) is the per-allele odds ratio. This model imposes a specific pattern: the odds ratio for genotype 2 versus genotype 0 is \(\exp(2\beta_1)\).

A categorical genotype model does not impose that pattern. Taking genotype 0 as the reference, it is

$$ \log\left\{\frac{P(Y=1\mid G)}{1-P(Y=1\mid G)}\right\} =\alpha+\gamma_1 I(G=1)+\gamma_2 I(G=2). $$

Here \(I(\cdot)\) is an indicator, equal to 1 when its condition is true and 0 otherwise. The odds ratios for genotypes 1 versus 0 and 2 versus 0 are \(\exp(\gamma_1)\) and \(\exp(\gamma_2)\), respectively. The categorical model estimates two genotype contrasts, while the additive model summarizes the association with one per-allele slope.

The basic calculations below assume independent participants, correctly classified case status and genotype, and a model appropriate to the association being summarized. For the simple unadjusted tables, there are no covariates. Logistic-regression standard errors and tests also rely on adequate information for the model; very small or empty cells can make estimates unstable or non-finite.

Worked Case-Control Table

Worked Example: Reading Counts as Genotype-Specific Odds

Suppose a hypothetical study recruits 280 cases and 120 controls. Genotypes are measured for every participant, and the counts are as follows.

Allele copies \(G\)CasesControlsSample case odds
0404040/40 = 1
1804080/40 = 2
216040160/40 = 4

The odds ratio for genotype 1 versus genotype 0 is \(2/1=2\). For genotype 2 versus genotype 0 it is \(4/1=4\). The genotype-specific odds double at each dosage step, so these counts follow the pattern of an additive logistic model with per-allele odds ratio 2. The overall case fraction, \(280/400=0.70\), is a feature of this hypothetical recruitment scheme, not an estimate that 70% of the source population has the disease.

Fitting and Interpreting the Additive Model

For the table above, the sample log odds at genotypes 0, 1, and 2 are \(\log(1)=0\), \(\log(2)\), and \(\log(4)\). These values lie on a straight line in allele count: each dosage step adds \(\log(2)\). The fitted coefficients are therefore \(\hat{\beta}_0=0\) and \(\hat{\beta}_1=\log(2)\), or approximately 0.6931. The per-allele odds ratio is \(\exp(0.6931)=2\).

A model-based Wald test evaluates \(H_0:\beta_1=0\), which corresponds to a per-allele odds ratio of 1. Its statistic is the estimated coefficient divided by its standard error and is compared with a standard normal distribution under the null for a large sample. The standard error can be obtained from the fitted logistic model's information matrix. In this grouped example, the fitted case probabilities are \(0.5\), \(2/3\), and \(0.8\) at \(G=0,1,2\). The corresponding logistic information weights are \(n_g\hat{p}_g(1-\hat{p}_g)\): 20, 26.6667, and 32.

Justification: For a logistic model with intercept and dosage, the information matrix is \(X^\mathsf{T}WX\), where each row of \(X\) is \((1,G)\), and \(W\) has the fitted logistic weights on its diagonal. The estimated variance of the slope is the lower-right entry of \((X^\mathsf{T}WX)^{-1}\). For the three genotype groups here, the information matrix is
$$ \begin{pmatrix} 78.6667 & 90.6667\\ 90.6667 & 154.6667 \end{pmatrix}. $$

For a two-by-two matrix with entries \(A,B;B,C\), the lower-right entry of its inverse is \(A/(AC-B^2)\). Thus the slope variance is approximately \(78.6667/(78.6667\times154.6667-90.6667^2)=0.01993\), giving \(SE(\hat{\beta}_1)=0.1412\). The Wald statistic is \(0.6931/0.1412=4.909\), corresponding to a two-sided p-value below 0.000001. The data provide strong evidence against a zero per-allele slope under this model; the test does not establish causation.

Worked Example: A Per-Allele Confidence Interval

Using the additive-model estimate and standard error above, a large-sample 95% Wald interval on the log-odds scale is \(\hat{\beta}_1\pm1.96SE(\hat{\beta}_1)\):

$$ 0.69315\pm1.96(0.14118) =0.69315\pm0.27672 =[0.41643,0.96987]. $$

Exponentiating both endpoints gives the interval for the per-allele odds ratio: \([\exp(0.41643),\exp(0.96987)]=[1.516,2.637]\). In this hypothetical case-control analysis, the interval estimates that each additional copy of the specified allele multiplies the odds of case status, relative to control status, by a factor between about 1.516 and 2.637 under the additive model. A 95% confidence procedure has 95% long-run coverage under its assumptions; this is not a 95% probability statement about the fixed parameter after observing this interval.

Categorical Genotype Effects

The categorical model reports comparisons with the reference genotype rather than imposing a constant per-allele multiplier. In the table, the estimated log odds ratios are \(\hat{\gamma}_1=\log(2)=0.6931\) and \(\hat{\gamma}_2=\log(4)=1.3863\). Exponentiating gives genotype odds ratios of 2 for genotype 1 versus 0, and 4 for genotype 2 versus 0. These happen to fit the additive pattern, but a different table need not do so.

For an unadjusted comparison of two genotype groups, the standard error of the log odds ratio is estimated from the four cells. If \(a,b\) are cases and controls in one genotype group and \(c,d\) are cases and controls in the reference group, respectively, then

$$ \widehat{OR}=\frac{a/b}{c/d}=\frac{ad}{bc}, \qquad SE\{\log(\widehat{OR})\} =\sqrt{\frac{1}{a}+\frac{1}{b}+\frac{1}{c}+\frac{1}{d}}. $$

This standard error is the large-sample table-based standard error for the log odds ratio. The categorical logistic model uses the same genotype contrasts; with a single unadjusted table, its coefficient estimates and their model-based uncertainty correspond to these comparisons.

Worked Example: Genotype-Specific Odds Ratios and Tests

For genotype 1 versus genotype 0 in the main table, \(a=80\), \(b=40\), \(c=40\), and \(d=40\). The odds ratio is \(80(40)/[40(40)]=2\). Its log-scale standard error is

$$ SE\{\log(\widehat{OR})\} =\sqrt{\frac{1}{80}+\frac{1}{40}+\frac{1}{40}+\frac{1}{40}} =\sqrt{0.08750} =0.2958. $$

The Wald statistic for \(H_0:\gamma_1=0\) is \(0.6931/0.2958=2.343\), with a two-sided p-value of about 0.0191. The 95% log-scale interval is \(0.6931\pm1.96(0.2958)=[0.1133,1.273]\); exponentiating gives an odds-ratio interval of approximately \([1.120,3.571]\). The interval excludes 1, consistent with the two-sided test at the 0.05 level.

For genotype 2 versus genotype 0, the odds ratio is \(160(40)/[40(40)]=4\). The standard error is \(\sqrt{1/160+1/40+1/40+1/40}=\sqrt{0.08125}=0.2850\). Its Wald statistic is \(1.3863/0.2850=4.864\), providing strong evidence against an odds ratio of 1. Each comparison uses genotype 0 as the reference; neither comparison estimates absolute disease risk.

A Separate Two-by-Two Calculation

Worked Example: Checking a Four-Cell Standard Error

Consider another hypothetical table, now comparing a genotype category with a reference category: among cases, 60 have the genotype category and 40 the reference; among controls, 60 have the genotype category and 80 the reference. The estimated odds ratio is

$$ \widehat{OR}=\frac{60(80)}{60(40)}=2, \qquad \hat{\beta}_1=\log(2)=0.6931. $$

The four reciprocal cell counts must all be included:

$$ SE(\hat{\beta}_1) =\sqrt{\frac{1}{60}+\frac{1}{60}+\frac{1}{40}+\frac{1}{80}} =\sqrt{0.0708333} =0.2661. $$

The 95% interval on the log scale is \(0.6931\pm1.96(0.2661)=[0.1715,1.2147]\). On the odds-ratio scale it is \([\exp(0.1715),\exp(1.2147)]=[1.187,3.369]\). The Wald statistic is \(0.6931/0.2661=2.605\), with a two-sided p-value of approximately 0.0092. The interval excludes 1, agreeing with the test at the 0.05 level.

Why Case-Control Sampling Preserves Odds-Ratio Slopes

The link between the case-control table and logistic slopes follows from how sampling changes case odds. Suppose cases and controls are sampled with probabilities \(s_1\) and \(s_0\), respectively, and these probabilities do not depend on genotype within disease status. If the source-population case probability at genotype \(G\) is \(p(G)\), the sampled case odds are

$$ \frac{P(\text{sampled case}\mid G)}{P(\text{sampled control}\mid G)} =\frac{s_1p(G)}{s_0\{1-p(G)\}} =\frac{s_1}{s_0}\frac{p(G)}{1-p(G)}. $$

Taking logarithms adds the constant \(\log(s_1/s_0)\) to the source-population log odds. The intercept changes, but the genotype slope does not. Consequently, the slope can estimate an odds-ratio association under this sampling scheme. The sampling fraction does not, by itself, identify the source-population disease probability or absolute risk.

Common Mistakes and Interpretation

  • Adding the wrong reciprocal counts. The four-cell standard error requires one reciprocal for each cell. Check the sum before taking its square root; a small arithmetic error changes both the confidence interval and test statistic.
  • Calling an odds ratio a risk ratio. An odds ratio compares odds, not probabilities. In a case-control sample, the recruited case fraction is determined by sampling and cannot be read as population risk.
  • Interpreting a per-allele estimate as an unrestricted genotype effect. The additive model assumes a constant multiplier per allele. The categorical model allows the two genotype contrasts to differ.
  • Reading a p-value as the probability that the null is true. A p-value is the probability, assuming the null and model conditions, of a test statistic at least as extreme as the observed one. It is not the probability that \(H_0\) is correct.

In practice, report the genotype coding and reference group alongside each estimate. State whether an odds ratio is per allele or compares a specific genotype with a reference, and give its confidence interval and test result. These details make clear what biological contrast the model represents, without turning an association into a causal claim.

Check Your Understanding

Use the definitions and calculations above to answer each question.

  1. In the additive model, what odds ratio corresponds to a one-unit increase in allele dosage, and what assumption connects genotype 2 with genotype 0?
  2. Why does the fraction of cases recruited into a case-control sample generally not estimate population disease prevalence?
  3. For a categorical model with genotype 0 as reference, what do \(\exp(\gamma_1)\) and \(\exp(\gamma_2)\) compare?
  4. For a two-by-two table with counts \(a,b,c,d\), write the estimated odds ratio and the standard error of its logarithm.
  5. What does a 95% confidence interval for an odds ratio describe, and why is it not a 95% probability that the fixed odds ratio lies in the observed interval?
Clinical Biostats