Why the Covariate’s Shape Matters
A continuous covariate is often entered into a genetic association model as a single linear term. That is a useful starting point, but it assumes that each one-unit increase in the covariate corresponds to the same change in the modeled outcome across its range. Age, body mass index, or a laboratory measurement may have a curved relationship with a quantitative trait instead. If the model forces that relationship to be linear, adjusted predictions can be systematically off even when the covariate is included.
The remedy is to represent the covariate’s association with the outcome more flexibly: for example, by transforming it or by using a restricted cubic spline. The genotype term remains explicit in the model, so its adjusted interpretation can be stated precisely. In this tutorial, \(G\) denotes an allele dosage coded 0, 1, or 2, \(C\) a continuous covariate, and \(Y\) a quantitative trait.
Linear Terms and Transformations
A basic quantitative-trait model with one genotype and one continuous covariate is
Here, \(\beta_C\) is the modeled mean change in \(Y\) per one-unit increase in \(C\), holding genotype fixed. The coefficient \(\beta_G\) is the modeled mean difference in \(Y\) per additional allele, holding \(C\) fixed. With \(G\) coded 0, 1, or 2, the model assumes a constant per-allele difference: the predicted difference between genotypes 0 and 2 is \(2\beta_G\).
Centering a covariate replaces \(C\) with \(C-c\), where \(c\) is a chosen reference value, often a meaningful value or the sample mean. It changes the intercept’s reference point, not the fitted relationship or the slope. A transformation changes the relationship’s shape and changes how the covariate coefficient must be interpreted. For a positive covariate, a model using \(\log(C/c)\) expresses changes in relation to the reference value \(c\).
Worked Example: Centering a Linear Covariate
Suppose a hypothetical study models systolic blood pressure \(Y\), in mmHg, using allele dosage \(G\) and age \(A\), in years. A fitted model is
The age term is linear and centered at 50 years. At age 60, its contribution is \(0.25(60-50)=2.5\) mmHg. For a person with \(G=0\), the fitted mean is \(120+1.4(0)+2.5=122.5\) mmHg. For the same age and \(G=2\), it is \(120+1.4(2)+2.5=125.3\) mmHg. The fitted genotype contrast is \(125.3-122.5=2.8\) mmHg, or \(1.4\) mmHg per allele. These are conditional fitted means from a hypothetical model, not evidence that genotype causes the difference.
The intercept, 120 mmHg, is the fitted mean at age 50 and \(G=0\). Centering makes that reference point explicit; it does not change the age slope or the genotype contrast.
A transformation is useful when a linear change in the transformed scale better represents the association than a linear change in the original scale. For example, a logarithmic term requires \(C>0\), and its coefficient is not a change per one original unit of \(C\). If the model includes \(\log(C/c)\), increasing \(C\) by a multiplicative factor \(r\) changes the covariate contribution by \(\beta_C\log(r)\). The logarithm is natural log unless otherwise specified.
Worked Example: Interpreting a Log-Transformed Covariate
Consider a hypothetical model for systolic blood pressure with a positive biomarker concentration \(C\), measured in mg/L:
At \(C=25\) mg/L, \(\log(C/25)=\log(1)=0\). At \(C=30\) mg/L, the covariate contribution relative to 25 mg/L is
Thus, at the same genotype, the fitted mean at 30 mg/L is about 1.459 mmHg higher than at 25 mg/L. For \(G=1\), the fitted means are \(120+1.1+0=121.1\) mmHg at 25 mg/L and \(120+1.1+1.4586=122.5586\) mmHg at 30 mg/L. The difference is \(1.4586\) mmHg. A doubling from 25 to 50 mg/L would correspond to \(8.0\log(2)\approx5.545\) mmHg, not 8.0 mmHg.
Restricted Cubic Splines
A restricted cubic spline (RCS) represents a covariate’s mean relationship with a piecewise cubic curve. The pieces join smoothly at selected values called knots. The restriction is that the curve is linear below the first knot and above the last knot. Between the boundary knots, it can bend, with smooth joins at the interior knots. With \(K\) knots, the usual RCS coding has one linear component and \(K-2\) additional basis terms, for \(K-1\) covariate degrees of freedom.
One common construction starts with ordered knots \(\kappa_1<\cdots<\kappa_K\) and defines \(d_k(C)=(C-\kappa_k)_+^3\), where \((u)_+=\max(u,0)\). For \(j=1,\ldots,K-2\), a restricted cubic basis function is
A model includes \(C\) and the \(K-2\) functions \(h_j(C)\), or equivalent scaled and centered versions of those terms. Below the first knot, all the truncated terms are zero. Above the last knot, the coefficients in each \(h_j\) make the cubic and quadratic terms cancel, leaving a linear function of \(C\). These properties give a flexible curve in the middle and linear tails. Software may use a different but equivalent basis; its individual spline coefficients then depend on the basis representation, while fitted values and the overall curve are the quantities of substantive interest.
Worked Example: Calculating an RCS-Adjusted Genotype Contrast
Suppose a hypothetical study uses BMI \(C\), in kg/m2, with four knots at 20, 25, 30, and 40. For clarity, define \(q_j(C)=h_j(C)/1000\), using the basis above, and suppose the fitted model for systolic blood pressure is
At \(C=25\), \(d_{20}=5^3=125\), while \(d_{25}=d_{30}=d_{40}=0\). The basis formula gives \(h_1(25)=125\) and \(h_2(25)=0\), so \(q_1(25)=0.125\) and \(q_2(25)=0\). The fitted spline contribution is \(-0.4(0.125)+0.6(0)=-0.05\) mmHg. The fitted mean for \(G=0\) is \(120-0.05=119.95\) mmHg; for \(G=2\), it is \(120+2.6-0.05=122.55\) mmHg. The genotype contrast at this BMI is \(2.60\) mmHg.
At \(C=35\), \(d_{20}=15^3=3375\), \(d_{25}=10^3=1000\), \(d_{30}=5^3=125\), and \(d_{40}=0\). The basis formula gives
Therefore \(q_1(35)=3.125\) and \(q_2(35)=0.8125\). The spline contribution is \(-0.4(3.125)+0.6(0.8125)=-1.25+0.4875=-0.7625\) mmHg. The fitted means are \(119.2375\) mmHg for \(G=0\) and \(121.8375\) mmHg for \(G=2\), a difference of \(2.60\) mmHg. The covariate contribution differs between BMI values, while the genotype contrast does not: this model has no genotype-by-BMI interaction.
Why the Genotype Interpretation Holds
The constancy of the genotype contrast in these examples follows directly from the model. Let \(f(C)\) stand for any specified covariate function: it could be a linear term, a logarithm, or a spline. With no genotype-by-covariate interaction, the conditional mean has the form \(\beta_0+\beta_GG+f(C)\). Comparing two genotype dosages \(G_1\) and \(G_0\) at the same covariate value gives
The shared covariate contribution cancels. This is why modeling a nonlinear covariate relationship does not, by itself, make the genotype effect vary over that covariate. To represent a genotype effect that varies with \(C\), the model needs genotype-by-covariate terms, and its genotype contrast must then be calculated at a stated value of \(C\). That is a distinct model choice, not an automatic consequence of using a spline.
For a conventional linear-model analysis, the conditional mean must be adequately represented by the chosen terms, and the observations must satisfy the independence assumptions used for the reported standard errors and tests. Standard exact small-sample \(t\)- and \(F\)-based inference additionally relies on normally distributed errors with constant variance; large-sample or alternative inference requires its own justification. A flexible covariate term does not resolve dependence, confounding, or other model problems. The genotype coefficient describes an adjusted association under the specified model, not necessarily a causal effect.
Choosing and Checking a Coding
A linear term is transparent and economical when a roughly straight-line relationship on the outcome’s modeled scale is plausible. A transformation may be suitable when a scientifically meaningful scale or a simple curved pattern is expected. An RCS can represent a wider range of smooth shapes without requiring the analyst to specify a single transformation in advance. In each case, the coding should be chosen with attention to the scientific question and the observed covariate range, not just to whether an individual coefficient has a small p-value.
The covariate coding also has a cost. Each additional basis term estimates another parameter, and flexible curves can be unstable where data are sparse, especially near the extremes. Knot number and placement affect the fitted curve; the knots should be stated, and predictions outside the observed covariate range should be treated cautiously. Plotting fitted means against the covariate, while holding other model terms fixed, can help reveal whether a straight-line term is inadequate. The plot is a diagnostic aid, not proof that the chosen model is correct.
Common Mistake
Wrong reasoning: “The covariate effect is nonlinear, so the genotype coefficient must also vary with the covariate.” This confuses the shape of \(f(C)\) with effect modification. In the additive model \(\beta_0+\beta_GG+f(C)\), the genotype contrast remains \(\beta_G\) per allele at each fixed \(C\). A varying genotype contrast requires explicit interaction terms. Another error is to describe the coefficient of \(\log(C)\) as the outcome change per one-unit increase in \(C\); its meaning depends on the change in the logarithm, such as a specified ratio of covariate values.
Check Your Understanding
Try these questions without looking back.
- In a model with \(G\), \(C-50\), and no interaction, what does the intercept represent, and does centering change the genotype coefficient?
- A model contains \(6\log(C/10)\). What is the covariate contribution to the fitted mean when \(C\) increases from 10 to 20, holding other terms fixed?
- What restriction distinguishes a restricted cubic spline from an unrestricted piecewise cubic curve?
- In the RCS model from the example, why is the fitted genotype contrast the same at BMI 25 and BMI 35?
- What additional model term is needed if the per-allele genotype contrast is intended to vary with a continuous covariate?