Why Coding Checks Matter
A genotype-effect model can be computed correctly and still answer the wrong question if its coding is misunderstood. Counting copies of the other allele reverses the direction of an allele-count coefficient. Changing the reference genotype changes the meaning of the intercept and contrasts. Indicators that overlap can also produce coefficients that are not the comparisons a reader assumes. These are interpretation errors, not necessarily calculation errors.
The key habit is to write down, for every genotype, its coded value or indicator pattern before interpreting a coefficient. This tutorial uses \(A\) and \(a\) for the two alleles at a locus. A genotype such as \(Aa\) has one copy of each allele. All numerical examples below are hypothetical.
Allele-count coding does not itself say that \(A\) is harmful, protective, common, or biologically active. It is a numerical choice that must be stated. Likewise, the reference genotype is a comparison baseline, not an assertion that it is normal or risk-free. The interpretation follows the model and coding, not the label attached to an allele or genotype.
Check the Allele Count Before Reading the Sign
For a quantitative trait \(Y\), an additive mean model using the \(A\)-allele count is
Here, \(\alpha\) is the modelled mean for \(aa\), because \(G=0\), and \(\beta\) is the change in modelled mean for each additional copy of \(A\). The model implies means \(\alpha\), \(\alpha+\beta\), and \(\alpha+2\beta\) for \(aa\), \(Aa\), and \(AA\), respectively. Thus, \(\beta\) has the units of \(Y\) per copy of \(A\). This interpretation requires the additive mean pattern to be an appropriate description; it does not follow merely from having entered a genotype variable into software.
If instead \(H\) counts copies of \(a\), then \(H=2-G\). A model using \(H\) can describe exactly the same genotype means, but its intercept and slope must change. In particular, the slope changes sign. This gives a direct way to diagnose an apparent sign disagreement: check which allele the count represents before concluding that the results conflict.
Worked Example: Reversing the Count Reverses the Slope
Suppose a hypothetical quantitative trait is measured in millimetres. There are five observations in each genotype group, with group means of 10 mm for \(aa\), 12 mm for \(Aa\), and 14 mm for \(AA\). Fit the additive mean trend using \(G=\) number of \(A\) copies.
The three genotype counts are \(0,1,2\), and their trait means are \(10,12,14\). Because the group sizes are equal, the slope from all observations equals the slope calculated from these three group means:
The fitted intercept is \(\hat{\alpha}=\bar{Y}-\hat{\beta}\bar{G}=12-(2)(1)=10\) mm. The fitted means are therefore 10 mm for \(aa\), \(10+2=12\) mm for \(Aa\), and \(10+2(2)=14\) mm for \(AA\).
Now define \(H\) as the number of \(a\) copies. The same groups have \(H=2,1,0\), respectively. The fitted line is \(E(Y\mid H)=14-2H\): it predicts 14 mm at \(H=0\), 12 mm at \(H=1\), and 10 mm at \(H=2\). The slope is \(-2\) mm per copy of \(a\). The negative sign does not indicate a changed relationship; it reflects counting the opposite allele.
Reference Genotypes and Indicator Patterns
A two-indicator model can represent three genotype-specific means without imposing an additive trend. Taking \(aa\) as the reference, define \(I_1=1\) for \(Aa\) and 0 otherwise, and \(I_2=1\) for \(AA\) and 0 otherwise. The model is
The indicators are mutually exclusive: for any one genotype, at most one of \(I_1\) and \(I_2\) equals 1. The intercept is the mean for \(aa\), \(\beta_1\) is the difference between \(Aa\) and \(aa\), and \(\beta_2\) is the difference between \(AA\) and \(aa\). These are two separate reference contrasts; they are not automatically per-allele effects.
Worked Example: Reading Genotype Indicators Correctly
In hypothetical data, the mean trait values are 8 units for \(aa\), 11 units for \(Aa\), and 15 units for \(AA\). Use \(aa\) as the reference and construct the two indicators just defined.
For \(aa\), \((I_1,I_2)=(0,0)\), so the fitted mean is \(\alpha=8\). For \(Aa\), \((I_1,I_2)=(1,0)\), giving \(8+\beta_1=11\), so \(\beta_1=3\) units. For \(AA\), \((I_1,I_2)=(0,1)\), giving \(8+\beta_2=15\), so \(\beta_2=7\) units. Thus, the heterozygote mean is 3 units above the reference mean, and the \(AA\) mean is 7 units above the reference mean. The differences are not equal, so these data do not follow the exact additive pattern used in the previous example.
A common indicator mistake is to define \(C=1\) for any carrier of \(A\) and \(J=1\) only for \(AA\), then read both coefficients as comparisons with \(aa\). In a model with these indicators, the predictions are \(\alpha\) for \(aa\), \(\alpha+\gamma_C\) for \(Aa\), and \(\alpha+\gamma_C+\gamma_J\) for \(AA\). Matching the means gives \(\alpha=8\), \(\gamma_C=11-8=3\), and \(\gamma_J=15-11=4\). Here \(\gamma_J\) is the additional difference between \(AA\) and \(Aa\), not the \(AA\)-versus-\(aa\) difference. The two indicators overlap for \(AA\), so the coefficient must be interpreted from the full pattern.
Changing the reference genotype also changes the coefficient meanings while leaving the genotype-specific fitted means unchanged. In the example above, if \(AA\) is the reference, the intercept is 15 units, the \(Aa\)-versus-\(AA\) contrast is \(11-15=-4\) units, and the \(aa\)-versus-\(AA\) contrast is \(8-15=-7\) units. A negative coefficient in this parameterization is consistent with the same means that gave positive contrasts when \(aa\) was the reference.
Interpreting Coefficients for Disease Risk
For a binary disease outcome \(D\), let \(D=1\) denote disease and \(D=0\) denote no disease. In a logistic model with \(G\) copies of \(A\),
In this model, \(\beta\) is a change in log odds per additional copy of \(A\); \(\exp(\beta)\) is the corresponding odds ratio per copy. Neither quantity is itself a risk difference or a risk ratio. To state a risk, convert the modelled odds or log odds to a probability. The genotype-specific risk also depends on the intercept and on the allele-count value.
Worked Example: Checking a Logistic Coefficient Against Risks
Suppose a hypothetical logistic model has a disease risk of 0.10 for \(aa\), and the odds ratio is 2.00 for each additional \(A\) copy. Verify the risks implied by the additive log-odds model and interpret the coefficient.
The baseline odds for \(aa\) are \(0.10/(1-0.10)=1/9\). The log-odds intercept is therefore \(\alpha=\log(1/9)\approx-2.197\), and the per-copy coefficient is \(\beta=\log(2)\approx0.6931\). For \(Aa\), the odds are \((1/9)\times2=2/9\), so the risk is
For \(AA\), the odds are \((1/9)\times2^2=4/9\), giving
Thus, the risks are 0.1000, 0.1818, and 0.3077 for \(aa\), \(Aa\), and \(AA\), respectively. The model says that each additional \(A\) copy multiplies the odds by 2.00 under the assumed additive log-odds pattern. It does not say that risk doubles: for example, \(0.1818/0.1000\approx1.818\), not 2.00. Reversing the count to copies of \(a\) would give a per-copy log-odds coefficient of \(-0.6931\) and an intercept of \(\alpha+2\beta\approx-0.8109\), with the same three fitted risks.
A Short Reparameterization Check
The sign reversal and intercept change under allele-count reversal can be verified algebraically. Start with the quantitative-trait model \(E(Y\mid G)=\alpha+\beta G\), and define \(H=2-G\), so \(G=2-H\). Substitute this expression into the original model:
Therefore, the intercept for the \(H\)-coded model is \(\alpha+2\beta\), and its slope is \(-\beta\). This is a change of coordinates: each genotype retains the same fitted mean. The same substitution applies to a logistic model's linear predictor, so its log-odds slope changes sign and its intercept shifts, while its genotype-specific probabilities remain the same.
A Practical Coding Audit
Before reporting a coefficient, check the model in a small table. Write down each genotype, its allele count, and each indicator value. Then calculate the model's prediction for every genotype. This simple audit exposes sign errors, unexpected reference groups, and indicators whose overlap changes the meaning of a coefficient.
Name the counted allele and list the values for \(aa\), \(Aa\), and \(AA\), or explicitly define each indicator.
Set all predictors to their values for the reference genotype. The resulting fitted value tells you what the intercept represents.
Change the relevant predictor according to the genotype coding while holding the other predictors as specified by the model.
For a quantitative-trait model, state trait units. For a logistic model, distinguish log odds, odds ratios, and probabilities.
Substitute each genotype's coding into the model and confirm that the resulting fitted values agree with the intended comparisons.
A frequent pitfall is to report “the allele increases disease risk” solely because a logistic coefficient is positive. That conclusion is incomplete: the sign depends on which allele is counted and which outcome is coded as 1, and the coefficient is on the log-odds scale. State the allele-count direction, the disease coding, and the scale of the effect. Also, a correctly interpreted association in a genotype-effect model does not by itself establish that the allele causes the trait.
Check Your Understanding
For each question, identify the coding or interpretation that should be checked before stating a genetic effect.
- If \(G\) counts copies of \(A\), what are the values of \(G\) for \(aa\), \(Aa\), and \(AA\)? What changes if the count instead records copies of \(a\)?
- A quantitative-trait model uses \(G=\) number of \(A\) copies and has slope \(-1.5\) millimetres per copy. State the model-based interpretation of the slope.
- In a two-indicator model with \(aa\) as the reference, what does the coefficient of \(I(G=2)\) compare?
- Suppose \(C=I(G\geq1)\) and \(J=I(G=2)\) are both predictors. What predictor values does \(AA\) receive, and why should the coefficient of \(J\) not automatically be called the \(AA\)-versus-\(aa\) contrast?
- A logistic coefficient is \(\log(1.5)\) per \(A\) copy. What is multiplied by 1.5 under the model, and what additional information is needed to calculate a genotype-specific risk?