With only 100 function evaluations, which of four inputs should be studied first? This example uses Morris elementary effects for a first screening pass: on each trajectory, one input is changed at a time and the response is observed. Results from 20 trajectories suggest refining x1 and x3 first, then x2; x4 has no effect in this constructed function.

Question and design

The four coded inputs x1, x2, x3, and x4 each take values in [0,1]. The measured response is the function value for each input combination: f = 2x1 + (x2 − 0.5)² + 4(x1 − 0.5)(x3 − 0.5). This is a deliberately constructed computer function; the coefficient on x4 is zero. The experimental goal is to identify, within the given ranges and budget, which inputs deserve further computational effort.

Each input is divided into six levels: {0, 0.2, 0.4, 0.6, 0.8, 1}. Take p = 6 and step size Δ = p/[2(p − 1)] = 0.6. A trajectory for four factors has 5 points: starting from an initial point, each factor is changed once in a random order. The two points before and after each step form a paired comparison while the other three inputs stay fixed; the response difference divided by the signed change in that factor is the elementary effect for that step.[1]

Twenty independently generated, unoptimized standard trajectories are arranged, for 20 × 5 = 100 function evaluations and 20 elementary effects per factor. Although there are 100 evaluations, different trajectories can visit the same location, so only 97 distinct input locations appear.

How to run and record

  1. Fix the NumPy random seed to 2026111753. For each factor on each trajectory, draw a base uniformly from {0, 0.2, 0.4} and a random step direction; the starting level is base for a positive step and 1 − base for a negative step.
  2. Randomly permute the four factors and, from the start, move each by 0.6 in its chosen direction. Save the trajectory id, point order, and four inputs; evaluate f once at each point and save the response, for 100 rows in total.
  3. Compare adjacent rows within a trajectory, recording which factor changed, the signed input difference, and the response difference. Compute EE = (f_after − f_before) / (x_after − x_before) and save the trajectory id with that effect, for 80 rows.
  4. Check that every input lies on the six-level grid and in [0,1]; check that each step changes exactly one factor by absolute amount 0.6. Then summarize the 20 EE values per factor.

This run generated trajectories under the rules above and saved all inputs, responses, and elementary effects. Grid, boundary, and single-factor step checks all passed; each of the 80 elementary effects was also checked against the function's analytic finite difference. Adjacent points are paired comparisons, and the five points on one trajectory jointly form a design; they must not be treated as independent sample observations.

Three-panel figure showing factor levels on the first trajectory, elementary-effect scatter by factor, and mean absolute effects with standard deviations

Twenty unoptimized Morris trajectories for a four-variable constructed function, 100 actual function evaluations, and 80 elementary effects; six levels, step size 0.6, one factor changed per step. μ* averages absolute values first; σ may reflect nonlinearity or interactions. Figure: drawn by the author from this example's computed results.

How to compute the three summaries

For each factor's 20 EE values, compute the signed mean μ = mean(EE), the mean of absolute values μ* = mean(|EE|), and the sample standard deviation σ using denominator 20 − 1. μ* takes absolute values first and then averages; it is not |mean(EE)|. That ordering keeps the typical magnitude before positive and negative effects cancel.[2]

Factor μ μ* σ
x1 2.04 2.04 1.2576
x2 −0.02 0.26 0.3302
x3 −0.08 1.16 1.4073
x4 0 0 0

How to read the results

x1 has the largest μ*, 2.04; x3 is next at 1.16. Looking only at μ, x3's −0.08 is easy to misread as a tiny effect. In fact, x3's elementary effects take both signs and cancel in the mean, while their absolute magnitudes remain large. Screening should therefore rank by μ* first, then use μ to see whether directions tend to cancel.

Next look at σ: 1.2576 for x1 and 1.4073 for x3, so their elementary effects vary markedly across trajectory backgrounds. In this function, the product term in x1 and x3 makes one factor's effect depend on the other; the squared term in x2 makes its effect depend on its own level. σ can flag that variation, but σ alone cannot separate nonlinearity from interaction, and it is not a significance p-value, a variance share, or a Sobol index.

What to refine next

The next round should study x1, x3, and their joint variation: place denser evaluation points on their level plane and watch how the response surface and one factor's effect change with the other. Then refine the curvature in x2. In this example both summaries for x4 are zero, matching a constructed function that excludes x4; that conclusion belongs to this function and must not be generalized to say a similarly named variable in a real model is irrelevant.

References

  1. [1] SALib. SALib.sample.morris.morris: sampling source.

  2. [2] SALib. SALib.analyze.morris: analysis source.