Tutorials › Quantitative Systems Pharmacology (QSP) › Deriving Sobol Indices from Functional ANOVA

Sensitivity Analysis and Model Reduction · Tutorial 663 of 799

Deriving Sobol Indices from Functional ANOVA

Learn how independence makes functional ANOVA components orthogonal, and how their variances define first-, second-, and total-order Sobol indices.

Advanced 12 min read

What You'll Learn

  • State the conditions for a functional ANOVA variance decomposition.
  • Construct main-effect and interaction components using conditional expectations.
  • Derive why distinct components are orthogonal and their variances sum to the output variance.
  • Calculate first-, second-, and total-order Sobol indices in worked models.
  • Identify why correlated inputs or zero output variance undermine the usual component interpretation.
  • Distinguish variance-based global measures from local derivative and screening approaches.

Why Decompose Output Variance?

A QSP model can respond to several uncertain inputs at once. A global sensitivity analysis asks how variation in a specified model output is apportioned across those inputs, including variation that arises through their interactions. Sobol indices answer this question by decomposing output variance into contributions associated with individual inputs and input subsets.

The decomposition is not a property of the equations alone. It depends on the probability distributions assigned to the inputs. In particular, the standard functional ANOVA decomposition identifies distinct variance contributions when the inputs are mutually independent. This tutorial derives that result and the indices that follow from it.

Definition: Let \(X=(X_1,\ldots,X_d)\) be mutually independent inputs with specified distributions, and let \(Y=f(X)\) be a deterministic model output. Assume \(f(X)\) is square-integrable, so \(E[Y^2]<\infty\), and has positive variance \(V=\operatorname{Var}(Y)>0\). The functional ANOVA decomposition writes \(f\) as a mean plus component functions indexed by nonempty input subsets. Under the independent product distribution, distinct components are orthogonal in the sense that their product has expectation zero.

Square-integrability ensures that the component variances are finite. Independence means the joint input distribution is the product of the marginal distributions. Inputs may be continuous, discrete, or a mixture. The model output and input distributions must be fixed for the indices to have a defined meaning. If \(V=0\), variance-based indices with denominator \(V\) are undefined.

Constructing the Functional ANOVA Components

For a subset \(u\) of input indices, write \(X_u\) for the inputs whose indices belong to \(u\). The empty-set component is the overall mean. The component for a nonempty set \(u\) is defined recursively: take the conditional mean of the model output given \(X_u\), then subtract the components already assigned to all proper subsets of \(u\).

$$ f_{\varnothing}=E[Y], \qquad f_u(X_u)=E[Y\mid X_u]-\sum_{v\subsetneq u} f_v(X_v), \quad u\ne\varnothing. $$

For a single input, this gives \(f_i(X_i)=E[Y\mid X_i]-E[Y]\), the centered main effect. For a pair, it gives \(f_{ij}(X_i,X_j)=E[Y\mid X_i,X_j]-f_{\varnothing}-f_i(X_i)-f_j(X_j)\), the part of the conditional response not accounted for by the mean and the two main effects. Components involving three or more inputs are defined in the same way.

The recursion gives the pointwise decomposition, up to sets of probability zero:

$$ Y=f_{\varnothing}+\sum_{\varnothing\ne u\subseteq\{1,\ldots,d\}} f_u(X_u). $$

The key property is that each component has conditional mean zero when any one of its own inputs is averaged out. For \(i\in u\), this is \(E[f_u(X_u)\mid X_{u\setminus\{i\}}]=0\). The property follows from the recursive definition and independence: integrating over \(X_i\) in \(E[Y\mid X_u]\) produces \(E[Y\mid X_{u\setminus\{i\}}]\), and the lower-order components subtract exactly the terms in that conditional mean.

Why the Variances Add

The conditional-mean-zero property makes components for different subsets orthogonal. To see this, choose distinct subsets \(u\) and \(v\). At least one input index belongs to one subset but not the other; without loss of generality, let \(i\in u\) and \(i\notin v\). Then \(f_v\) does not depend on \(X_i\). Conditional on all inputs other than \(X_i\), \(f_v\) is fixed, while the conditional mean of \(f_u\) over \(X_i\) is zero. Therefore \(E[f_u f_v]=0\). This also applies when one component is the constant mean and the other is centered.

Squaring the decomposition and taking expectations now leaves no cross-products between distinct components. Since each nonconstant component has mean zero, its second moment is its variance. Thus the output variance is the sum of the component variances:

$$ V=\operatorname{Var}(Y) =\sum_{\varnothing\ne u\subseteq\{1,\ldots,d\}} V_u, \qquad V_u=E[f_u(X_u)^2]. $$

This is the substantive role of independence: it makes the conditional-mean construction yield orthogonal components, so each \(V_u\) is a nonnegative, separately identifiable contribution to total variance. With dependent inputs, the same formulas do not generally yield orthogonal components or a unique allocation of variance to subsets. A correlated-input analysis therefore needs a different allocation framework rather than treating these standard Sobol components as if independence still held.

First-, Second-, and Total-Order Indices

A first-order index is the fraction of output variance assigned to one input's main-effect component. A second-order index is the fraction assigned to the component for a specified pair, after the mean and both main effects have been removed. More generally, \(S_u\) is the fraction assigned to subset \(u\).

$$ S_u=\frac{V_u}{V}, \qquad S_i=\frac{V_i}{V}, \qquad S_{ij}=\frac{V_{ij}}{V}. $$

The total-order index for input \(i\) sums the variance fractions of every component that includes \(i\), including its main effect and all its interactions with other inputs. It can also be expressed using a conditional variance:

$$ S_{T_i}=\sum_{u:\,i\in u} S_u =\frac{E[\operatorname{Var}(Y\mid X_{-i})]}{V} =1-\frac{\operatorname{Var}(E[Y\mid X_{-i}])}{V}. $$

Here \(X_{-i}\) denotes all inputs except \(X_i\). To justify the conditional-variance form, condition on \(X_{-i}\). Components not involving \(i\) are fixed under that conditioning; the components involving \(i\) have conditional mean zero. Their conditional variances add because they remain orthogonal when averaged over \(X_i\). Averaging over \(X_{-i}\) gives \(\sum_{u:i\in u}V_u\). The final equality follows from the law of total variance: \(V=E[\operatorname{Var}(Y\mid X_{-i})]+\operatorname{Var}(E[Y\mid X_{-i}])\).

Worked Example: Main Effects and a Pairwise Interaction

Hypothetical model. Let \(X_1\) and \(X_2\) be independent, each taking \(-1\) or \(1\) with probability \(1/2\), and let \(Y=X_1+X_2+2X_1X_2\). Calculate its ANOVA components and indices.

Each input has mean zero and variance one. Independence gives \(E[X_1X_2]=0\). Hence \(f_{\varnothing}=E[Y]=0\), and conditioning on either input gives \(f_1(X_1)=X_1\) and \(f_2(X_2)=X_2\). Subtracting these terms from the conditional response given both inputs leaves \(f_{12}(X_1,X_2)=2X_1X_2\).

The component variances are \(V_1=E[X_1^2]=1\), \(V_2=E[X_2^2]=1\), and \(V_{12}=E[(2X_1X_2)^2]=4E[X_1^2]E[X_2^2]=4\). Therefore \(V=1+1+4=6\).

The first-order indices are \(S_1=1/6\approx0.1667\) and \(S_2=1/6\approx0.1667\). The pairwise index is \(S_{12}=4/6=2/3\approx0.6667\). Each total-order index includes its main effect and the pair component: \(S_{T_1}=S_{T_2}=(1+4)/6=5/6\approx0.8333\). The two first-order indices do not sum to one because the remaining \(4/6\) of variance belongs to the interaction.

Worked Example: An Additive Model with Unequal Input Scales

Hypothetical model. Let \(X_1\sim\operatorname{Uniform}(0,1)\) and \(X_2\sim\operatorname{Uniform}(0,2)\), independently, and set \(Y=3+2X_1-X_2\). Determine the component variances and indices.

The input means are \(E[X_1]=0.5\) and \(E[X_2]=1\), so \(E[Y]=3\). The main effects are \(f_1=2(X_1-0.5)\) and \(f_2=-(X_2-1)\). Because the model is additive, the conditional response given both inputs is already the sum of the mean and these main effects; thus \(f_{12}=0\).

A uniform distribution on an interval of width \(a\) has variance \(a^2/12\). Consequently, \(\operatorname{Var}(X_1)=1/12\) and \(\operatorname{Var}(X_2)=4/12=1/3\). It follows that \(V_1=4(1/12)=1/3\), \(V_2=1(1/3)=1/3\), and \(V=2/3\). There is no interaction variance.

Thus \(S_1=(1/3)/(2/3)=0.5\), \(S_2=0.5\), and \(S_{12}=0\). Since neither input interacts with the other, \(S_{T_1}=S_1=0.5\) and \(S_{T_2}=S_2=0.5\). The equal indices do not mean the inputs have equal numerical ranges; they mean each accounts for half the output variance under these specified distributions and this model.

Worked Example: Total Effects in a Three-Input Model

Hypothetical model. Let \(X_1,X_2,X_3\) be mutually independent standard normal inputs, and define \(Y=X_1+2X_2+X_1X_2+3X_2X_3\). Find its nonzero components, variance, and Sobol indices.

Each input has mean zero and variance one. The model mean is zero. Conditioning on individual inputs gives \(f_1=X_1\), \(f_2=2X_2\), and \(f_3=0\). Conditioning on pairs and subtracting the mean and main effects leaves \(f_{12}=X_1X_2\) and \(f_{23}=3X_2X_3\); \(f_{13}=0\). There is no three-input component.

The component variances are \(V_1=1\), \(V_2=4\), \(V_3=0\), \(V_{12}=E[X_1^2]E[X_2^2]=1\), and \(V_{23}=9E[X_2^2]E[X_3^2]=9\). The total is \(V=1+4+0+1+9=15\).

The first-order indices are \(S_1=1/15\approx0.06667\), \(S_2=4/15\approx0.2667\), and \(S_3=0\). The pairwise indices are \(S_{12}=1/15\approx0.06667\) and \(S_{23}=9/15=0.6\); \(S_{13}=0\). The total-order indices are \(S_{T_1}=(1+1)/15=2/15\approx0.1333\), \(S_{T_2}=(4+1+9)/15=14/15\approx0.9333\), and \(S_{T_3}=9/15=0.6\). Input \(X_3\) has no main effect but has a nonzero total effect because it contributes through the interaction with \(X_2\).

Assumptions, Diagnostics, and Alternatives

Before interpreting a decomposition, check that it matches the scientific question and the uncertainty representation. Independence is a substantive assumption about the joint distribution used for the analysis, not a consequence of the model equations. If calibrated parameter draws are dependent, the standard independent-input decomposition is not automatically an identifiable attribution among those parameters. Also check that the output is a scalar quantity with finite, nonzero variance under the chosen input distributions.

Theoretical component variances cannot be negative, and their sum must equal \(V\). First-order indices lie between zero and one; total-order indices do as well, and \(S_i\leq S_{T_i}\). For a complete decomposition, the sum of all subset indices is one, while the first-order indices alone generally sum to less than or equal to one. If numerical estimates violate these properties, possible explanations include finite-sample error, coding or scaling errors, or a mismatch between the assumed input distribution and the one actually sampled. A computed zero component can reflect genuine absence of that modeled contribution, but it can also arise from a particular output and input distribution that suppresses variation.

The introductory material on Morris elementary effects motivates screening with a relatively economical measure, but its elementary effects are not the same variance partition as Sobol indices. Local derivatives describe response near particular input values and can be useful when local behavior is the target; they do not by themselves allocate global output variance, especially when interactions or nonlinearities matter. Functional ANOVA instead provides a global variance accounting under independent inputs, at the cost of requiring an appropriate input distribution and a well-defined output variance.

Common pitfall: “The first-order indices add to one, so the inputs explain all output variability independently.” This is wrong whenever interaction components are nonzero. The full sum over all nonempty subsets equals one; first-order indices account only for main effects. For example, in the first worked example, the first-order indices sum to \(1/3\), while the pairwise interaction accounts for the remaining \(2/3\).
Key takeaway: Under independent inputs and finite, positive output variance, the functional ANOVA components are orthogonal and their variances add to the total. Sobol indices are these variance contributions divided by total variance; total-order indices include every interaction involving the specified input.

Check Your Understanding

Answer each question, then compare with the solutions below.

  1. What assumptions let the functional ANOVA component variances be interpreted as separate contributions that sum to output variance?
  2. For independent centered inputs with unit variance, suppose \(Y=2X_1+X_2\). Find \(V_1\), \(V_2\), \(V\), and the first-order indices.
  3. In a two-input model, suppose \(V_1=2\), \(V_2=1\), and \(V_{12}=3\). Find \(V\), both first-order indices, and both total-order indices.
  4. Why can an input have a zero first-order index but a positive total-order index?

Solutions. (1) Inputs must be mutually independent under the specified distributions; the deterministic output must be square-integrable with positive variance. Independence gives orthogonality, making component variances additive. (2) The components are \(f_1=2X_1\) and \(f_2=X_2\), with no interaction. Thus \(V_1=4\), \(V_2=1\), \(V=5\), \(S_1=4/5=0.8\), and \(S_2=1/5=0.2\). (3) \(V=2+1+3=6\). The first-order indices are \(S_1=2/6=1/3\) and \(S_2=1/6\). The total-order indices are \(S_{T_1}=(2+3)/6=5/6\) and \(S_{T_2}=(1+3)/6=2/3\). (4) Its main-effect component may be zero while an interaction component containing that input has positive variance; the total-order index includes both main and interaction components.

Clinical Biostats