Tutorials › Statistical Genetics › Modeling Nonlinear Exposure-Response Interaction

Gene–Environment Interaction · Tutorial 803 of 989

Modeling Nonlinear Exposure-Response Interaction

Use spline regression to estimate genotype-specific exposure-response curves and test jointly whether their exposure patterns differ.

Advanced 11 min read

What You'll Learn

  • Represent nonlinear exposure effects with a prespecified spline basis
  • Write a regression model with genotype-specific exposure-response curves
  • Distinguish curve-shape differences from genotype differences in baseline level
  • Construct a joint test of genotype-by-spline interaction coefficients
  • Interpret Wald and partial F tests with their assumptions and limits

Why Model Nonlinear Exposure-Response Interaction?

An exposure may relate to a quantitative outcome differently across genotypes, and that relation need not be a straight line. For example, an outcome might change rapidly at low exposure, then level off; another genotype might show a gradual increase throughout the observed range. A model with one exposure term and one genotype-by-exposure product term can represent differing straight-line slopes, but it cannot generally represent these curved patterns.

Spline regression addresses this limitation by expressing exposure through several fixed basis functions. Genotype-by-basis terms then allow the exposure-response curve to vary across genotype groups. The joint test of those terms asks whether the exposure-related parts of the curves differ, without requiring a linear exposure effect.

Definition: A spline basis is a set of prespecified functions of exposure, \(B_1(E),\ldots,B_q(E)\), used as regression predictors to represent a smooth or piecewise-polynomial exposure-response relation. A genotype-by-basis interaction is a product of a genotype indicator and one of these basis functions. Its coefficient allows the corresponding exposure pattern to differ by genotype.

A Model for Genotype-Specific Curves

Let \(Y_i\) be a quantitative outcome for person \(i\), \(E_i\) a quantitative exposure, and \(G_i\) a categorical genotype with \(K\) groups. Choose genotype group 0 as the reference. Let \(C_{i1},\ldots,C_{ir}\) denote covariates whose effects are modeled as shared across genotype groups. With \(q\) exposure-basis functions, one linear regression model is

$$ Y_i=\beta_0+\sum_{g=1}^{K-1}\delta_g I(G_i=g) +\sum_{j=1}^{q}\theta_jB_j(E_i) +\sum_{g=1}^{K-1}\sum_{j=1}^{q}\phi_{gj}I(G_i=g)B_j(E_i) +\sum_{\ell=1}^{r}\gamma_\ell C_{i\ell}+\varepsilon_i. $$

Here \(I(G_i=g)\) equals 1 when person \(i\) is in genotype group \(g\), and 0 otherwise. The coefficients \(\delta_g\) allow genotype groups to differ in level; the \(\theta_j\) describe the reference group's exposure curve; and \(\phi_{gj}\) allow group \(g\)'s exposure curve to differ from the reference. The model specifies \(E(\varepsilon_i\mid E_i,G_i,C_i)=0\). For the usual partial F test in a finite sample, we additionally assume independent normally distributed errors with a common variance. The regression form also assumes that the chosen basis and covariate terms adequately represent the conditional mean over the analyzed data.

Holding the covariates fixed, the fitted mean for group \(g\) is a function of exposure. For the reference group it is \(\beta_0+\sum_j\theta_jB_j(E)\), plus the shared covariate contribution. For group \(g>0\), it additionally includes \(\delta_g+\sum_j\phi_{gj}B_j(E)\). Thus group-specific curves can have different levels as well as different exposure patterns.

The basis must be chosen before interpreting the model. For example, a truncated linear spline with a knot at \(c\) can use \(B_1(E)=E\) and \(B_2(E)=(E-c)_+\), where \((E-c)_+=\max(E-c,0)\). This gives a continuous piecewise-linear curve with a possible change in slope at \(c\). More flexible cubic spline bases can represent smoother curvature. Knot locations, basis dimension, and any boundary constraints determine which curves the model can represent; they are not learned merely by adding interaction terms.

Worked Example: Reading Fitted Curves From a Spline Model

Suppose a hypothetical analysis uses three genotype groups, coded 0, 1, and 2, and the truncated linear basis \(B_1(E)=E\), \(B_2(E)=(E-5)_+\). Assume the fitted exposure-related terms and genotype levels give these curves, with covariates held fixed:

$$ \begin{aligned} \widehat{\mu}_0(E)&=10+0.8B_1(E)-0.2B_2(E),\\ \widehat{\mu}_1(E)&=11+0.5B_1(E)+0.1B_2(E),\\ \widehat{\mu}_2(E)&=9+1.1B_1(E)-0.3B_2(E). \end{aligned} $$

The numbers are hypothetical, and the outcome is measured in units \(Y\); exposure is measured in units \(E\). At exposure \(E=2\), \(B_1(2)=2\) and \(B_2(2)=0\). Therefore, the fitted means are \(10+0.8(2)-0.2(0)=11.6\) units for genotype 0, \(11+0.5(2)+0.1(0)=12.0\) units for genotype 1, and \(9+1.1(2)-0.3(0)=11.2\) units for genotype 2.

At \(E=7\), \(B_1(7)=7\) and \(B_2(7)=2\). The corresponding fitted means are \(10+0.8(7)-0.2(2)=15.2\), \(11+0.5(7)+0.1(2)=14.7\), and \(9+1.1(7)-0.3(2)=16.1\) outcome units. Above the knot, the slopes per exposure unit are \(0.8-0.2=0.6\), \(0.5+0.1=0.6\), and \(1.1-0.3=0.8\), respectively. The curves are not forced to be straight across the full exposure range, and their patterns are not identical.

What Does “The Curves Differ” Mean?

There are two related but distinct comparisons. The exposure-interaction null is

$$ H_0:\phi_{gj}=0\text{ for every }g=1,\ldots,K-1\text{ and }j=1,\ldots,q. $$

Under this null, genotype groups share the same exposure-related basis coefficients. Their fitted curves can still have different constant levels because the \(\delta_g\) terms remain in the model. This test therefore assesses whether the exposure-response patterns differ, not whether the full mean curves coincide at every exposure.

If the scientific question instead concerns equality of the entire curves, the null must also set every genotype-level difference to zero: \(H_0:\delta_g=0\) and \(\phi_{gj}=0\) for all relevant \(g,j\). That broader test mixes baseline differences with exposure-related differences. Stating which null is being tested prevents a genotype main effect from being mistaken for evidence of exposure effect modification.

With a reference-group coding and a basis that excludes a constant function, the exposure-interaction null imposes \(m=(K-1)q\) restrictions. It is a joint test: individual coefficient tests do not replace it, because the basis coefficients jointly determine the curve and may be correlated.

Joint Wald Test

Let \(\widehat{\boldsymbol{\phi}}\) collect the \(m\) estimated genotype-by-basis coefficients, and let \(\widehat V\) be their estimated covariance matrix from the fitted model. The Wald statistic for the interaction null is

$$ W=\widehat{\boldsymbol{\phi}}^{\,T}\widehat V^{-1}\widehat{\boldsymbol{\phi}}. $$

When the null is true and the usual large-sample approximation is appropriate, \(W\) has an approximate chi-square distribution with \(m\) degrees of freedom. The p-value is the probability, under that reference distribution and the null, of a statistic at least as large as the observed \(W\). This test accounts for the estimated covariance among the interaction coefficients.

Worked Example: Wald Test of a Nonlinear Interaction

Suppose a hypothetical study has two genotype groups and uses a spline basis with three exposure functions. There are \(m=(2-1)3=3\) genotype-by-basis coefficients. In the fitted model, their estimates are \((0.30,0.20,0.20)^T\), and their estimated covariance matrix is \(0.01I_3\), where \(I_3\) is the \(3\)-by-\(3\) identity matrix. The Wald statistic is

$$ W=\frac{0.30^2}{0.01}+\frac{0.20^2}{0.01}+\frac{0.20^2}{0.01} =9+4+4=17. $$

Under the joint null, the reference distribution is approximately \(\chi^2_3\). Its upper-tail probability at 17 is approximately \(0.0007067\). Since \(0.0007067<0.05\), this hypothetical analysis rejects the exposure-interaction null at the 0.05 significance level. The result is evidence that the modeled exposure-response patterns differ by genotype; it does not by itself establish that genotype causes the difference.

Nested-Model Partial F Test

For a linear model with independent, normally distributed errors of common variance, the same null can be tested by comparing two nested fits. The unrestricted model includes all genotype-by-basis terms. The reduced model removes those terms but retains genotype main effects, the shared exposure basis, and the same covariates. Let \(RSS_R\) and \(RSS_F\) be their residual sums of squares, and let \(p_F\) be the number of fitted parameters in the unrestricted model. The partial F statistic is

$$ F=\frac{(RSS_R-RSS_F)/m}{RSS_F/(n-p_F)}. $$

Under the null and the stated model assumptions, this statistic has an \(F\) distribution with \(m\) and \(n-p_F\) degrees of freedom. The numerator measures the reduction in residual variation per restriction; the denominator estimates the error variance in the unrestricted model. The comparison is valid only when the two fits use the same observations and differ only by the tested interaction terms.

Justification: Under the null, the reduced model is adequate, so the extra \(m\) interaction coefficients should reduce \(RSS\) only by the amount expected from fitting noise. With normal errors of variance \(\sigma^2\), \((RSS_R-RSS_F)/\sigma^2\) has a chi-square distribution with \(m\) degrees of freedom, and \(RSS_F/\sigma^2\) has a chi-square distribution with \(n-p_F\) degrees of freedom. For nested normal linear models these quantities are independent. Dividing each by its degrees of freedom and taking their ratio gives the stated \(F\) reference distribution.

Worked Example: Partial F Test Across Three Genotype Groups

Consider a hypothetical sample of \(n=180\) individuals, three genotype groups, and a spline basis with \(q=2\) exposure functions. The interaction null imposes \(m=(3-1)2=4\) restrictions. Suppose the unrestricted model contains an intercept, two genotype indicators, two shared exposure-basis terms, four interaction terms, and three shared covariate terms, so \(p_F=12\). Assume the reduced and unrestricted fits use the same 180 individuals and have \(RSS_R=252\) and \(RSS_F=224\).

The unrestricted residual degrees of freedom are \(180-12=168\). Thus

$$ F=\frac{(252-224)/4}{224/168} =\frac{28/4}{1.3333} =\frac{7}{1.3333} \approx 5.250. $$

The reference distribution is \(F_{4,168}\). The upper-tail probability is below 0.001, so the interaction null is rejected at the 0.05 level. In this hypothetical analysis, allowing genotype-specific exposure patterns improves fit beyond what is expected under the null. The calculation concerns this chosen spline model and its assumptions; it does not show that every possible curve differs or that the relationship is causal.

Choosing and Interpreting the Basis

A spline basis offers flexibility, not freedom from modeling decisions. The basis dimension controls how many distinct exposure patterns can be represented. Too few basis functions may miss important curvature; too many may produce imprecise estimates, especially when some genotype groups have little data across the exposure range. Knots and boundary behavior should be selected using subject-matter knowledge and a prespecified analysis plan where possible.

Interpretation is usually clearer from fitted curves or contrasts at meaningful exposure values than from a single basis coefficient. A coefficient on \(B_j(E)\) describes a change associated with that particular basis function while the other model terms are held fixed; it is not generally a per-unit exposure effect. Predictions should be restricted to exposure values with adequate data support in the genotype groups being compared. A fitted curve beyond that support is extrapolation and may be driven mainly by the chosen basis.

As in other regression models, adjustment for measured covariates does not automatically make an association causal. A causal interpretation requires an appropriate design and assumptions about confounding, selection, and measurement, in addition to a correctly specified outcome model. The interaction test alone addresses a statistical comparison of modeled exposure patterns.

Common Mistake

A frequent error is to test only the coefficient of \(G\times E\) in a linear model and conclude that there is no genotype-by-exposure interaction when that coefficient is not significant. That conclusion is limited to the chosen straight-line interaction. If the true difference is curvature or a change in slope over part of the exposure range, a single product term may not represent it. The correction is to use a prespecified spline basis suited to the scientific question and test all genotype-by-basis coefficients jointly. Conversely, a significant joint test indicates differences within the fitted basis model, not proof of a particular biological mechanism.

Key takeaway: To assess nonlinear exposure-response interaction, represent exposure with a spline basis, interact its basis functions with genotype indicators, and test those interaction coefficients jointly. Retain genotype main effects when the question is whether exposure patterns differ rather than whether all genotype-specific curves are identical.

Check Your Understanding

Answer each question by identifying the model component or assumption involved.

  1. With four genotype groups and a spline basis of five functions, how many restrictions are in the joint test that the exposure-response patterns are shared?
  2. Why can genotype groups have different fitted outcome levels even when all genotype-by-basis coefficients equal zero?
  3. In a truncated linear spline with one knot, what feature of the exposure-response curve can change at the knot?
  4. What two nested models are compared in the partial F test of genotype-by-basis interaction?
  5. Why is a significant joint test not, by itself, evidence that genotype causally changes the effect of exposure?
Clinical Biostats