Why Genotype Coding Changes the Question
A biallelic variant has three possible genotypes. Once an effect allele has been designated, let \(G\) be the number of copies of that allele: \(G=0,1,\) or \(2\). A regression analysis must represent these three values with one or more predictors. The choice is not merely a computational convenience: it determines which patterns of genotype-specific trait means are represented by the model and, therefore, what association pattern is being tested.
This tutorial compares three common choices for a quantitative trait: additive dosage, dominant, and recessive coding. The aim is to understand what each coding says about the means, not to assume that any one genetic pattern is true in advance. Genotype indicators for unrestricted nonadditive effects provide a useful reference: they allow the heterozygote and the two homozygote groups to have separate means. Each one-predictor coding considered here makes a more specific restriction.
For clarity, the basic models below have an intercept and one genotype predictor, with no additional covariates. Their mean patterns can be read directly from the predicted mean at each genotype. In an applied GWAS, other variables may also be included, but that does not change the meaning of the genotype coding itself.
| Coding and model | Predicted means for \(G=0,1,2\) | Pattern represented |
|---|---|---|
| Additive: \(E[Y\mid G]=\beta_0+\beta_A G\) | \(\beta_0,\ \beta_0+\beta_A,\ \beta_0+2\beta_A\) | Equal change in mean per additional effect-allele copy |
| Dominant: \(E[Y\mid D]=\beta_0+\beta_D D\) | \(\beta_0,\ \beta_0+\beta_D,\ \beta_0+\beta_D\) | Both carrier groups share a mean different from the \(G=0\) group |
| Recessive: \(E[Y\mid R]=\beta_0+\beta_R R\) | \(\beta_0,\ \beta_0,\ \beta_0+\beta_R\) | The \(G=2\) group differs from the \(G=0,1\) groups, which share a mean |
Here \(\beta_A\) is a change in mean trait value per additional effect-allele copy under the additive model. The dominant coefficient \(\beta_D\) is the mean difference between carriers and noncarriers under the dominant model. The recessive coefficient \(\beta_R\) is the mean difference between individuals with two effect-allele copies and those with zero or one. These coefficients have trait units, but they describe different contrasts and should not be compared as if they were the same effect.
Assumptions and What Each Test Addresses
Each coding is commonly fitted by ordinary least squares. For a model with predictor \(X\), the conditional mean is specified as \(E[Y\mid X]=\beta_0+\beta_1X\), where \(X\) is \(G\), \(D\), or \(R\), respectively. The standard regression test of no association tests \(H_0:\beta_1=0\) against a two-sided alternative. Under the specified model, this null says that the mean does not change with the coded predictor. It does not establish that the biological effect is absent in every possible model.
For the usual small-sample \(t\)-test and confidence interval from ordinary least squares, assume independent observations, a correctly specified conditional mean, and errors with constant variance and a normal distribution conditional on the predictor. With larger samples, inference can often rely on approximate sampling theory, but dependence between participants or unequal residual variances can still make standard errors inappropriate if ignored. The coding also requires the genotype groups that define its contrast to be represented: a dominant contrast needs both carriers and noncarriers, while a recessive contrast needs both \(G=2\) individuals and individuals with \(G=0\) or \(1\).
These models describe association, not causation. Population structure, relatedness, selection, or other factors associated with both genotype and trait can complicate interpretation. Genotype coding by itself does not control those issues. Nor does a significant result prove that the chosen pattern is the unique or biologically correct one.
Why the Binary-Coding Coefficient Is a Group Difference
The dominant and recessive models each use a binary predictor. With an intercept and a binary predictor \(Z\), the fitted model is \(E[Y\mid Z]=\beta_0+\beta_1Z\). If both groups are observed, the joint least-squares fit gives each group its own fitted mean: \(\hat\beta_0=\bar{Y}_{Z=0}\) and \(\hat\beta_0+\hat\beta_1=\bar{Y}_{Z=1}\). Subtracting these fitted means gives the coefficient interpretation.
This result follows from the joint fit, not from minimizing over the intercept while holding an arbitrary slope fixed. To see why, write the residual sum of squares as a sum over the two groups. For any fixed fitted value in a group, the sum of squared deviations is minimized when that fitted value is the group sample mean. Since the model with an intercept and binary \(Z\) can choose both group fitted values freely, the minimum occurs at the two group means. The slope is their difference. For dominant coding, \(Z=D\); for recessive coding, \(Z=R\).
Worked Examples: Reading the Mean Patterns
Worked Example: A Pattern Consistent With Additive Dosage
Suppose a hypothetical sample has genotype-specific mean trait values of 5, 7, and 9 units for \(G=0,1,2\), respectively, with group sizes 40, 35, and 25. The observed means increase by 2 units at each additional effect-allele copy, matching the additive pattern.
Additive fit. These group means lie exactly on \(\hat{Y}=5+2G\): at \(G=0\), the prediction is \(5+2(0)=5\); at \(G=1\), it is \(5+2(1)=7\); and at \(G=2\), it is \(5+2(2)=9\). Thus the fitted additive slope is 2 trait units per effect-allele copy for these group means.
Dominant contrast. The carrier mean combines the \(G=1\) and \(G=2\) groups, weighted by their sizes: \(\bar{Y}_{D=1}=[35(7)+25(9)]/60=470/60=7.833\) units. The noncarrier mean is 5 units, so the dominant contrast is \(7.833-5=2.833\) units.
Recessive contrast. The \(G=0,1\) mean is \([40(5)+35(7)]/75=445/75=5.933\) units. The \(G=2\) mean is 9 units, so the recessive contrast is \(9-5.933=3.067\) units. Those contrasts are not the additive slope: they compare differently pooled groups.
This example establishes the fitted group-mean contrasts only. Group sizes and means alone do not provide the within-group variation needed to calculate a standard error or a \(p\)-value.
Worked Example: A Pattern Consistent With Dominant Coding
In a second hypothetical sample, suppose the means for \(G=0,1,2\) are 10, 14, and 14 units, with group sizes 50, 40, and 10. The carriers have the same observed mean, while the noncarriers have a lower mean.
Dominant contrast. The carrier mean is \([40(14)+10(14)]/50=700/50=14\) units. The noncarrier mean is 10 units, so the dominant coefficient estimated from these means is \(14-10=4\) units.
Additive fit. The weighted mean dosage is \(\bar{G}=[40(1)+10(2)]/100=0.6\), and the weighted trait mean is \(\bar{Y}=[50(10)+40(14)+10(14)]/100=12\). The additive least-squares slope based on the group means is \(\sum n_g(g-\bar G)(\bar Y_g-\bar Y)\ /\ \sum n_g(g-\bar G)^2\). The numerator is \(50(-0.6)(-2)+40(0.4)(2)+10(1.4)(2)=60+32+28=120\). The denominator is \(50(0.36)+40(0.16)+10(1.96)=18+6.4+19.6=44\). Therefore \(\hat\beta_A=120/44=2.727\) units per copy. The additive fit represents a linear trend, not the observed equality of the two carrier means.
Recessive contrast. The pooled \(G=0,1\) mean is \([50(10)+40(14)]/90=1060/90=11.778\) units. The \(G=2\) mean is 14 units, so the recessive contrast is \(14-11.778=2.222\) units. The dominant contrast most directly represents the pattern in these particular group means, though this descriptive fit alone does not establish statistical significance or a biological mechanism.
Worked Example: A Pattern Consistent With Recessive Coding
Suppose a third hypothetical sample has means of 3, 3, and 8 units for \(G=0,1,2\), with group sizes 60, 30, and 10. The two groups with fewer than two effect-allele copies have the same observed mean, while the \(G=2\) group has a higher mean.
Recessive contrast. The pooled \(G=0,1\) mean is \([60(3)+30(3)]/90=270/90=3\) units. The \(G=2\) mean is 8 units. Thus the recessive contrast is \(8-3=5\) units.
Dominant contrast. The carrier mean is \([30(3)+10(8)]/40=170/40=4.25\) units. Compared with the noncarrier mean of 3 units, the dominant contrast is \(4.25-3=1.25\) units.
Additive fit. Here \(\bar{G}=[30+20]/100=0.5\) and \(\bar{Y}=[60(3)+30(3)+10(8)]/100=3.5\). The slope numerator is \(60(-0.5)(-0.5)+30(0.5)(-0.5)+10(1.5)(4.5)=15-7.5+67.5=75\). The denominator is \(60(0.25)+30(0.25)+10(2.25)=15+7.5+22.5=45\), giving \(\hat\beta_A=75/45=1.667\) units per copy. The additive line summarizes a trend but does not reproduce the equal means at \(G=0\) and \(G=1\).
Only 10 individuals are in the \(G=2\) group in this example. Even a large observed difference may have substantial uncertainty when the group defining the recessive contrast is small. The group means alone are not enough to quantify that uncertainty.
Choosing a Coding Before Looking at Results
Each coding is a different one-degree-of-freedom test of association. Additive coding tests for a linear change in mean across effect-allele dosage. Dominant coding tests whether the carrier mean differs from the noncarrier mean under the constraint that the two carrier groups share a mean. Recessive coding tests whether the two-copy group differs from the combined zero- and one-copy groups under the constraint that those latter groups share a mean. A coding can be useful when its pattern is scientifically motivated, but it can fit poorly if the actual genotype means do not follow its restriction.
Choosing whichever coding produces the smallest \(p\)-value after inspecting all three results creates a selection problem. Even if each test is calibrated at significance level \(\alpha=0.05\), the chance of at least one false positive is not generally 0.05 when several tests are examined and the most favorable result is reported. If three tests were independent, that chance under a global null would be \(1-(1-0.05)^3=0.1426\). The tests here are usually correlated because they use the same individuals and genotype groups, so 0.1426 is an illustration under independence, not the actual error rate for every analysis.
A defensible approach is to specify a primary coding before examining association results, based on the scientific question or a justified prior model. If multiple encodings are explored, report that exploration transparently and use an inferential strategy that accounts for the selection or confirm the pattern in independent data. Do not describe the smallest unadjusted \(p\)-value as though only one prespecified test had been performed.
Diagnostics and Limitations
- Inspect all three genotype counts and means. A coding imposes equality constraints on some means. Large departures from those constraints suggest that the chosen simple pattern may not describe the data well.
- Check for sparse groups. A small \(G=2\) group can make the recessive contrast unstable; few noncarriers can similarly undermine the dominant contrast. If a defining group is absent, its contrast cannot be estimated from these data.
- Keep the allele definition fixed. Switching which allele is counted changes the interpretation of \(G\), including the direction of an additive slope and which group is labeled homozygous for the counted allele. State the counted allele and genotype mapping.
- Do not treat a coding as a diagnostic cure. A more favorable \(p\)-value does not demonstrate that a model's mean constraints are correct, and a nonsignificant result does not prove equal genotype means.
- Remember what this comparison leaves out. These are one-predictor quantitative-trait models. They do not by themselves handle population structure, relatedness, covariate adjustment, nonconstant residual variance, or case-control outcomes.
The main practical trade-off is simplicity versus flexibility. A one-predictor coding gives a compact, interpretable contrast and uses one regression coefficient. Genotype indicators can represent three distinct means and avoid the additive, dominant, or recessive equality constraint, but they use more parameters and may be imprecise when groups are small. The appropriate choice depends on the scientific target and analysis plan, not on which encoding looks best after testing.
Check Your Understanding
Answer each question, then compare your reasoning with the solutions.
- If genotype means for \(G=0,1,2\) are 4, 6, and 8 units, what additive slope do these means imply?
- For means of 5, 9, and 9 units with group sizes 20, 30, and 10, calculate the dominant contrast.
- For means of 2, 2, and 7 units with group sizes 40, 20, and 10, calculate the recessive contrast.
- Why is it misleading to test all three codings and report only the smallest unadjusted \(p\)-value as if it came from a prespecified test?
- If no sampled individual has \(G=2\), can the recessive contrast be estimated? Explain.
Solutions. (1) The means follow \(4+2G\), so the additive slope is 2 trait units per effect-allele copy. (2) The carrier mean is \([30(9)+10(9)]/40=9\); subtracting the noncarrier mean gives \(9-5=4\) units. (3) The pooled \(G=0,1\) mean is \([40(2)+20(2)]/60=2\); the contrast is \(7-2=5\) units. (4) Selecting the most favorable result from several tests changes the false-positive behavior; the tests are not generally a single prespecified test, and the selection must be accounted for or reported as exploratory. (5) No. With no \(G=2\) observations, there is no observed group mean for the recessive-coded group, so that contrast is not estimable.