Concept Architecture
Grid Search for Calibrating and Tuning Health Economic Models
Grid search fixes a short list of candidate values for each unknown parameter, runs the model once for every combination of those values and keeps the combination with the best score. In health economics the method is used in calibrating disease models, where natural history parameters that cannot be observed directly are chosen so that modelled incidence or mortality matches registry or trial data. Its appeal is transparency, since every run is recorded and the fit across the searched region can be inspected. Its weakness is cost, because the number of runs is the product of the number of values tried for each parameter. Grid search is a form of numerical optimisation that uses no gradients and learns nothing from earlier runs, which makes it a simple reference point for judging directed methods.
Building the grid and the score it minimises
Each parameter is given a plausible range and a number of candidate values inside it, usually evenly spaced. Kong and colleagues, writing about disease simulation models, describe grid search as dividing each parameter between its minimum and maximum values into regular grids and comparing the results of all possible combinations with the calibration targets.
where and are the lower and upper bounds for parameter , is its number of candidate values, is the step between neighbouring values and is the th candidate value.
The grid is the set of every combination of candidate values, and the search returns the point with the lowest score. A score that should be maximised, such as a likelihood, is handled by minimising its negative.
where holds one value for each of the parameters, is the set of candidate values for parameter , is the grid, is the score of the run at , is the best grid point and is the number of runs the full grid needs. Bergstra and Bengio note that this product makes grid search suffer from the curse of dimensionality, because the number of joint values grows exponentially with the number of parameters.
In calibration the score is a goodness-of-fit measure. Stout and colleagues describe likelihood measures and distances between model output and target such as the sum of squared errors, and note that an overall measure may be a raw sum or a weighted average across targets.
where is the number of calibration targets, is the observed value of target , is the model's prediction of that target and is its weight.
Where grid search is used in health economic work
Grids appear in health economic analysis in three ways. Calibration and model tuning treat the grid as a search for one best point, while sensitivity and threshold analyses keep the whole grid as a map of results.
Calibrating disease natural history
In their review of calibration in cancer simulation models, Stout and colleagues found search algorithms generally not well described. Where they were specified, the formal ones included grid search and random sampling alongside directed methods. In a 2024 study of Bayesian optimisation for cost-effectiveness models, Gómez-Guillén and colleagues list grid search among general-purpose methods in current use, adequate for models of low to moderate complexity but not for more complex ones. Grid search is one way to carry out the search step of the wider calibration process.
Grids also turn up inside larger calibrations for small auxiliary fits. In a Bayesian calibration of a colorectal cancer microsimulation model, Rutter and colleagues used a grid search to choose the mean and standard deviation of a truncated Normal age distribution that came closest to the reported values for each study population.
Tuning prediction models
Prediction models used in health economics, such as models of high-cost patients, have settings that are chosen rather than estimated. In machine learning, Bergstra and Bengio report that grid search and manual search are the most widely used strategies for choosing these hyperparameters, with each candidate scored on held-out data by cross-validation. Varma and Simon, for instance, scored a support vector machine on a grid in which the trade-off parameter took values between and . They showed that the lowest cross-validated error found in such a search is a biased estimate of the true error, and that a nested procedure, with tuning repeated inside each outer fold, gives an almost unbiased estimate.
Grids that map a decision rather than optimise
A two-way sensitivity analysis runs the model over a lattice of values for two parameters, and a threshold analysis looks for the values at which the preferred option changes. The arithmetic is that of a grid search, but the output kept is the whole surface rather than one best point. Latin hypercube sampling instead draws a stratified random sample across the ranges.
Resolution, range and the cost of each added parameter
A grid can locate the optimum no more finely than its step. Along each axis every value in the range lies within half a step of a candidate, but when parameters interact the best grid point need not be the candidate nearest the true optimum. A best point on the edge of the grid suggests that the range was too narrow. Rates, small probabilities and many hyperparameters act on a multiplicative scale, so their candidates are often spaced evenly on a log scale.
The run count is the main constraint. Kong and colleagues give the example of a model with 20 unobservable parameters, where testing only 10 values of each would need parameter sets, and they judged simulated annealing and a genetic algorithm faster than grid search because grid search time multiplies with every added parameter. Their lung cancer model needed 24 minutes to simulate 500,000 life histories, so a grid of 10 values on each of three parameters would take 1,000 runs, or 24,000 minutes (400 hours) on one such computer.
When only a few parameters affect the score, a grid wastes runs. In the nine-trial illustration of Bergstra and Bengio, a 3 by 3 grid tests the important parameter in only three distinct places, while nine random trials test nine. They still credit grids with simple implementation and trivial parallelism, and call grid search reliable in one or two dimensions.
In a stochastic microsimulation each score carries Monte Carlo error, so neighbouring grid points can swap rank by chance. Using common random numbers across grid points makes the comparison less noisy.
Worked example calibrating a two-parameter cohort model
All numbers in this example are illustrative. A cohort model of an untreated chronic disease has two parameters that no study measures directly, the annual probability of disease onset and the probability that a person with the disease dies of it within the 10-year horizon. Registry data give two targets, a 10-year cumulative incidence of 25.0 per 100 people and 5.0 disease deaths per 100 people.
The model's cumulative incidence per 100 people is and its disease deaths per 100 people are . The score is the unweighted sum of squared deviations.
where is modelled cumulative incidence, is modelled disease deaths, and 25 and 5 are the registry targets, each per 100 people.
1. Set the first grid. The candidates are in {0.02, 0.03, 0.04} and in {0.15, 0.20, 0.25}, so the grid needs 3 × 3 = 9 runs.
2. Run the model at each point. When is 0.03 the term is 0.7374, so incidence is 100 × (1 − 0.7374) = 26.26 per 100. With set at 0.20, disease deaths are 26.26 × 0.20 = 5.25 per 100.
3. Score every point. For (0.03, 0.20) the deviations are 1.26 and 0.25, so the score is 1.5876 + 0.0625 = 1.65, using the rounded outputs shown.
| 0.02 | 0.15 | 18.29 | 2.74 | 50.13 |
| 0.02 | 0.20 | 18.29 | 3.66 | 46.82 |
| 0.02 | 0.25 | 18.29 | 4.57 | 45.21 |
| 0.03 | 0.15 | 26.26 | 3.94 | 2.71 |
| 0.03 | 0.20 | 26.26 | 5.25 | 1.65 |
| 0.03 | 0.25 | 26.26 | 6.57 | 4.05 |
| 0.04 | 0.15 | 33.52 | 5.03 | 72.59 |
| 0.04 | 0.20 | 33.52 | 6.70 | 75.48 |
| 0.04 | 0.25 | 33.52 | 8.38 | 84.01 |
4. Read the result. The best grid point is = 0.03 and = 0.20. The point (0.04, 0.15) matches the death target almost exactly but overshoots incidence by 8.52 and scores 72.59. The exact solution sets to 0.75, so , which is 0.0284, and = 5 / 25 = 0.20, so the true lies between the first grid's candidates.
5. Refine around the best point. A second grid with in {0.026, 0.028, 0.030, 0.032} and in {0.19, 0.20, 0.21} needs 4 × 3 = 12 runs. Its best point is (0.028, 0.20), where incidence is 24.72 and deaths are 4.94, so the score is 0.0784 + 0.0036 = 0.08. The runner-up, (0.028, 0.21), scores 0.11, so the targets separate these candidates only weakly.
6. Carry the result into the evaluation. An illustrative treatment halves case fatality. Disease deaths averted per 1,000 people are 1,000 × ( / 100) × × 0.5. The first grid's best point gives 10 × 26.26 × 0.20 × 0.5 = 26.3, the second grid's gives 10 × 24.72 × 0.20 × 0.5 = 24.7 and the exact solution gives 10 × 25.0 × 0.20 × 0.5 = 25.0. The coarse grid overstates the benefit by about 5%, an error that would carry into the QALY gain and the ICER. The two passes used 9 + 12 = 21 runs.
What the best grid point can and cannot support
Grid search returns one parameter set, the best of those tried, and says nothing on its own about how certain that set is. Rutter and colleagues point out that calibration methods based on a grid search for the best fit do not provide interval estimates, unlike the Bayesian calibration they proposed. A cost-effectiveness analysis that carries only the best grid point forward leaves calibration uncertainty out of the probabilistic sensitivity analysis.
The full score table still helps, since near ties like the 0.08 and 0.11 in the worked example warn that the targets may not pin the parameters down. Stout and colleagues proposed a calibration reporting checklist covering targets, goodness-of-fit metrics, search algorithms, acceptance criteria and stopping rules, and note that a stopping rule may rest on the extent of the parameter space searched. For a grid that means stating the ranges, the step for each parameter, the number of runs and the scores of the leading points.
Grid search beside random, directed and Bayesian search
The alternatives differ in how they choose the next run. Random search draws points independently over the same ranges, so trials can be added or dropped during a search, which Bergstra and Bengio note is not possible for a grid. Directed methods such as gradient descent and the Nelder-Mead method use earlier results to move towards better fit, and Bayesian optimisation fits a surrogate to all previous runs to choose the next one.
| Method | How the next run is chosen | Suited to |
|---|---|---|
| Grid search | Fixed in advance on a regular lattice | A few parameters and fast models |
| Random search | Independent draws over the ranges | Many parameters of which few matter |
| Gradient descent | Step against the gradient of the score | Smooth scores with usable derivatives |
| Nelder-Mead | Moves a simplex of recent points | A few parameters, no derivatives |
| Simulated annealing, genetic algorithms | Stochastic moves guided by earlier scores | Many parameters |
| Bayesian optimisation | Surrogate model fitted to all earlier runs | Slow simulation models |
A coarse grid can also supply starting points for a directed method, which then refines the best few, so the grid covers the region while most runs go where fit is good.
Common misreadings of grid search results
Most errors come from treating the best grid point as more than the best of a fixed list. Three recur in calibration and tuning work.
- Reading the best point as the optimum. Exhaustive search guarantees only the best point on the grid, and the true optimum can lie between candidates, as it did for in the worked example.
- Reporting the minimum cross-validated error from a tuning grid as expected performance. Varma and Simon showed this is optimistic and that nested cross-validation corrects it.
- Passing one best-fitting set to the economic model as if it were known. Near ties and calibration uncertainty belong in the sensitivity analysis.
Sources
- Bergstra J, Bengio Y. Random search for hyper-parameter optimization. Journal of Machine Learning Research. 2012;13:281-305. https://www.jmlr.org/papers/volume13/bergstra12a/bergstra12a.pdf
- Gómez-Guillén D, Díaz M, Arcos JL, Cerquides J. Bayesian optimization with additive kernels for a stepwise calibration of simulation models for cost-effectiveness analysis. International Journal of Computational Intelligence Systems. 2024;17:249. https://doi.org/10.1007/s44196-024-00646-x
- Kong CY, McMahon PM, Gazelle GS. Calibration of disease simulation model using an engineering approach. Value in Health. 2009;12(4):521-529. https://doi.org/10.1111/j.1524-4733.2008.00484.x
- Rutter CM, Miglioretti DL, Savarino JE. Bayesian calibration of microsimulation models. Journal of the American Statistical Association. 2009;104(488):1338-1350. https://doi.org/10.1198/jasa.2009.ap07466
- Stout NK, Knudsen AB, Kong CY, McMahon PM, Gazelle GS. Calibration methods used in cancer simulation models and suggested reporting guidelines. PharmacoEconomics. 2009;27(7):533-545. https://doi.org/10.2165/11314830-000000000-00000
- Varma S, Simon R. Bias in error estimation when using cross-validation for model selection. BMC Bioinformatics. 2006;7:91. https://doi.org/10.1186/1471-2105-7-91
Related Concepts (3)
Library
Publications
1
Decision Modelling for Health Economic Evaluation — Briggs, Claxton & Sculpher, 1st Edition ed., 2006 (Oxford University Press)
Foundational textbook on decision-analytic modelling for economic evaluation, covering decision trees, Markov models, handling parameter and structural uncertainty, probabilistic sensitivity analysis, and value of information. Volume 1 in the Handbooks in Health Economic Evaluation series.
BookView source →
Frequently Asked Questions (6)
What is grid search?
Grid search is an optimisation method that tests every combination of preset parameter values, used to calibrate and tune health economic models.
Source: Kong et al. 2009
Why does grid search become impractical with many parameters?
The number of runs equals the product of the number of candidate values tried for each parameter, so every added parameter multiplies the total. Kong and colleagues give the example of a disease model with 20 unobservable parameters, where testing only 10 values of each would need 10 to the power 20 parameter sets. Their lung cancer model took 24 minutes to simulate 500,000 life histories, so even a grid of 10 values on each of three parameters would need 1,000 runs, or about 400 hours on one computer. For this reason they found simulated annealing and a genetic algorithm faster than grid search for calibrating models with many parameters.
Source: Kong et al. 2009
How does grid search work?
Each unknown parameter is given a range between a minimum and a maximum, and that range is divided into a regular set of candidate values, usually evenly spaced. The model is then run once for every possible combination of those values, and each run is scored by how closely its outputs match the calibration targets. The combination with the best score is kept. Because the search is exhaustive, it finds the best point on the grid, although the true optimum can lie between candidates, so a finer second grid can then be placed around the first best point.
Source: Kong et al. 2009
What are the advantages of grid search?
Grid search is simple to implement and needs no gradients, so it can be applied to any model that returns a score. Bergstra and Bengio note that its runs are trivially parallel, since no run depends on the result of another, and they describe it as reliable in one or two dimensions. Every combination is recorded, so the full table of scores shows how fit varies across the searched region and reveals near ties that warn the targets may not pin the parameters down. A coarse grid can also supply starting points for a directed method that refines the best few.
Source: Bergstra & Bengio 2012
What are the limitations of grid search?
Grid search returns only the best of the points tried, and the true optimum can lie between candidates, so a coarse grid can shift the parameters carried into an economic model. The run count multiplies with every added parameter, which limits the method to problems with a few parameters and fast models. Rutter and colleagues point out that calibration based on a grid search for the best fit gives no interval estimates, unlike Bayesian calibration. A cost-effectiveness analysis that carries forward only the best grid point therefore leaves calibration uncertainty out of the probabilistic sensitivity analysis.
Source: Rutter et al. 2009
When is grid search used in modelling?
One setting is the calibration of disease simulation models, in which natural history parameters that cannot be observed are chosen so that modelled incidence or mortality matches registry or trial data. In their review of calibration in cancer simulation models, Stout and colleagues found that formal search algorithms, where specified, included grid search and random sampling alongside directed methods. Grids also appear in tuning the hyperparameters of prediction models, with each candidate scored by cross-validation. The same lattice of runs underlies two-way sensitivity and threshold analyses, which keep the whole surface of results rather than one best point.
Source: Stout et al. 2009
Trust Record
Verified by Dr Darrin Baines
British health economist
Professional identity: darrinbaines.org
Verification date: 26 Oct 2026
Content version: 1.0.1
Canonical Identity
- Persistent URI
- https://healtheconomics.wiki/concept/grid-search
- Term code
- HE-EM-DM-040
Stable URI · Machine-readable · Resolvable · CC BY 4.0
