Concept Architecture
Conditional Logic for Model Inputs That Depend on Age, Time, History and Treatment Response
In a decision-analytic model, conditional logic decides which value applies to a simulated patient or cohort at a given point, such as a mortality risk for the patient's current age, a higher fracture risk after a first fracture, or a drug cost that stops once a patient has failed to respond. The rules are written as if-then statements in a spreadsheet or code, or built into the model through extra states and tracked patient attributes. A rule applied one cycle late changes the incremental cost-effectiveness ratio as surely as a wrong input. Routing in questionnaires is covered on the branching logic page.
What a model can condition on
The ISPOR-SMDM report on state-transition modelling by Siebert and colleagues lists, among the formal elements of such a model, logical tests performed at the beginning of each cycle to determine the transitions, alongside states, transition probabilities, state values and termination criteria. In a decision tree, each branch probability is a conditional probability given the path already taken, so the tree itself is a set of nested conditions.
Conditions in health economic models fall into a few groups, each with a usual implementation.
| Condition | Typical example | Usual implementation |
|---|---|---|
| Time since the model started, or attained age | Background mortality rising with age | A transition matrix that changes each cycle |
| Time spent in a state | Risk of complications falling with time since onset | Tunnel states or a time-in-state attribute |
| History of earlier events | Higher fracture risk after a previous fracture | Extra states in a cohort model, or a tracked attribute |
| Patient characteristics | Mortality by sex, or drug dose by body weight | Separate subgroups, or attributes in a simulation |
| Response or test result | Stopping a drug for people who have not responded | A rule that switches costs and effects off for part of the cohort |
The ISPOR-SMDM report states that the state descriptors or tracker variables must include all relevant histories, such as past states, risk factors, time in state and time since last event, that determine transition probabilities, utilities or costs.
Conditions in cohort models
A cohort model can only hold conditions that apply to everyone in a state at the same time, or that can be written into the definition of the states. The Markov assumption is the default. The report by Siebert and colleagues describes its primary disadvantage as the assumption that transition probabilities depend neither on past states nor on the time spent in the current state, which can be very limiting in clinical applications.
Alarid-Escudero and colleagues, in their tutorial on time-dependent cohort state-transition models, separate two kinds of time condition. Simulation-time dependence lets transition probabilities vary with time since the start of the simulation, and they give age-specific background mortality as a common example. It is implemented with a transition matrix indexed by cycle, as below.
where is the row vector of the shares of the cohort in each state at cycle and is the transition matrix that applies in cycle . State-residence time dependence, where a risk depends on how long a person has been in a state, cannot be handled this way, because people enter the state at different cycles. The tutorial expands the state into one-cycle tunnel states, one for each cycle that must be tracked, and advises considering simulation-time dependence first because state expansion can be cumbersome.
History conditions work the same way. The ISPOR-SMDM report gives the example of a myocardial infarction risk that depends on a prior myocardial infarction, which requires states that record the earlier event. It warns that screening strategies whose interval depends on screening history can lead to state explosion, so that an individual-level model with tracker variables may be needed. Its best practice is to choose a cohort simulation when the problem can be represented by a manageable number of states that include the relevant history.
Conditions in individual-level models
Individual-level models carry conditions on each simulated person. The ISPOR-SMDM report describes individual-level state-transition models as keeping track of each individual's history through tracker variables, with transition probabilities defined as a function of those characteristics. In discrete event simulation, the ISPOR-SMDM report by Karnon and colleagues holds such conditions as patient attributes, for example time since diagnosis, and describes time checks that sample events conditional on a continuous measure such as HbA1c.
The NICE Decision Support Unit's Technical Support Document 15 on patient-level simulation, by Davis and colleagues, explains that the time to future events can be made dependent on patient attributes, including the history of previous events. It also warns that, depending on the complexity of the problem, the number of logical rules needed to make transition matrices depend on previous history or time in state may make programming errors difficult to detect in a spreadsheet.
Response-based continuation rules in NICE appraisals
A treatment continuation rule is a conditional rule used in technology appraisal, under which treatment continues only for people whose condition achieves a specified response within a given time. The NICE technology appraisal manual (PMG36, section 4.9.13) states that such a rule should not be analysed as a separate subgroup. The strategy that includes the rule is instead analysed as a separate scenario, as an additional treatment strategy alongside the base-case interventions and comparators, so that the costs and health consequences of additional monitoring can be included.
The manual also asks whether the response end point and the timing of its measurement are plausible and appropriate, whether the response criteria can reasonably be achieved, whether the rule can be incorporated into routine clinical practice, and about fairness in withdrawing treatment from people whose condition does not respond.
Worked example with a response-based stopping rule and an off-by-one error
All figures are illustrative. A cohort of 1,000 people with a chronic condition starts a new drug costing GBP 1,000 a month. Response is assessed at the end of month 3, at a cost of GBP 100 per person, and 40% respond. Responders have an annual utility of 0.80 while treated; non-responders, and everyone on standard care, have 0.60. The model uses monthly cycles over a 12-month horizon, with no deaths, no discounting and no other cost differences between strategies. Under the continuation rule, the expected drug cost per person in month is set as follows.
where is the expected drug cost per person in month , is the monthly drug cost (GBP 1,000), is the share of the cohort still on treatment and is the response rate (0.40).
1. Treat everyone for 12 months. Drug cost is 12 × 1,000 = GBP 12,000 per person, or GBP 12,000,000 for the cohort. QALYs per person are 0.40 × 0.80 + 0.60 × 0.60 = 0.68, or 680 for the cohort, against 600 on standard care.
2. Apply the continuation rule. Per person, months 1 to 3 cost 3 × 1,000 = GBP 3,000, months 4 to 12 cost 9 × 0.40 × 1,000 = GBP 3,600, and the assessment adds GBP 100, giving GBP 6,700, or GBP 6,700,000 for the cohort. Non-responders gain nothing from the drug, so stopping it after month 3 leaves QALYs at 680.
3. Compare the strategies. Against standard care, the rule gives an ICER of 6,700,000 / 80 = GBP 83,750 per QALY gained. Treating everyone costs GBP 5,300,000 more than the rule for no extra QALYs, so it is dominated.
4. Introduce a boundary error. The rule should switch costs to the responder share from month 4, which in spreadsheet terms is a test of the form "cycle greater than 3". If it is written as "cycle greater than or equal to 3", the whole cohort is charged for only two months before the rule applies. The cost per person becomes 2 × 1,000 + 10 × 0.40 × 1,000 + 100 = GBP 6,100, the cohort cost GBP 6,100,000, and the ICER 6,100,000 / 80 = GBP 76,250 per QALY.
5. Interpretation. The rule cuts the cost of treating everyone by 5,300,000 / 12,000,000, about 44%, with no loss of health. The one-cycle error understates the cost of the rule by GBP 600,000, about 9%, and so flatters the rule. In a microsimulation, where the rule is applied to each person instead of to the expected share of the cohort, each simulated person would carry a responder flag drawn with probability 0.40, and the average cost per person would approach GBP 6,700 as the number of simulated people grows.
Choices that change the result
Several modelling choices sit inside conditional logic. One is the time scale a condition uses, model time or time since an event. Another is whether the condition is held in the states or in patient attributes, which is the choice between a cohort and an individual-level model; PMG36 (section 4.6.3) expects the type of model and its structure to be justified for each new decision problem.
Order and boundaries matter as much as content. Nested conditions that test "age at least 50" before "age at least 60" apply the younger band to everyone aged 50 or over, and inclusive or exclusive boundaries decide the cycle in which a change happens. Conditions should be exhaustive and mutually exclusive, so that every patient meets exactly one in each cycle.
Checking that conditions behave as intended
Because errors in logical rules can be hard to detect, as Technical Support Document 15 warns, they need targeted checks. The TECH-VER checklist by Büyükkaramikli and colleagues, which organises verification into five stages from input calculations to overall validation, recommends black-box tests against prior expectations under plausible and extreme inputs, then white-box tests of code line by line or spreadsheet formulae cell by cell, then replication, each later step being needed when the earlier one fails.
Its black-box tests expose faulty conditions, for example setting the effectiveness, utility and safety inputs equal for all treatment options, after which every option should accumulate the same life-years and QALYs. Its examples of detected errors include a student course model in which a drug acquisition cost that should have depended on body weight was held constant. In another, from an appraisal of idelalisib for refractory follicular lymphoma, time to death after progression was re-sampled every month as if each patient had just progressed, which overestimated post-progression survival when the extrapolation distribution was not exponential. The exponential is the only continuous distribution without memory, so re-sampling from it does no harm, while for any other distribution the model loses the condition on time already spent since progression.
How conditional logic relates to nearby ideas
Branching logic is mainly about routing, meaning which questions a respondent sees or which path a patient follows through a tree. A conditional probability is a quantity, while conditional logic is the rule that decides which probability applies. The Markov assumption and memorylessness describe the absence of history conditions, and tunnel states and tracker variables add them back. A scenario analysis changes assumptions across runs, whereas conditional logic changes values within one run.
Limitations and common misreadings
Conditional logic adds realism at a cost in transparency, because the more history a model carries in logical rules, the harder they are to inspect. A cohort model cannot apply a rule that depends on a combination of individual events unless every combination is a state, which leads to the state explosion the ISPOR-SMDM report describes.
Several misreadings recur. A rule driven by model time is taken to represent time since an event that happens part-way through the model. A continuation rule is reported as a subgroup result, which PMG36 says it should not be, instead of as a separate strategy with its own assessment costs. Conditions are hidden in hard-coded formulae, so a reviewer cannot see that a cost depends on weight. The absence of a condition is read as neutral, when it is an assumption that the omitted factor does not matter, and it belongs in the reported structural uncertainty.
Sources
- Alarid-Escudero F, Krijkamp E, Enns EA, Yang A, Hunink MGM, Pechlivanoglou P, Jalal H. A tutorial on time-dependent cohort state-transition models in R using a cost-effectiveness analysis example. Medical Decision Making. 2023;43(1):21-41. https://doi.org/10.1177/0272989X221121747
- Briggs A, Claxton K, Sculpher M. Decision Modelling for Health Economic Evaluation. Oxford: Oxford University Press; 2006.
- Büyükkaramikli NC, Rutten-van Mölken MPMH, Severens JL, Al M. TECH-VER: a verification checklist to reduce errors in models and improve their credibility. PharmacoEconomics. 2019;37(11):1391-1408. https://doi.org/10.1007/s40273-019-00844-y
- Davis S, Stevenson M, Tappenden P, Wailoo A. NICE DSU Technical Support Document 15: cost-effectiveness modelling using patient-level simulation. Sheffield: Decision Support Unit, ScHARR, University of Sheffield; April 2014. https://www.sheffield.ac.uk/nice-dsu/tsds/patient-level-simulation
- Karnon J, Stahl J, Brennan A, Caro JJ, Mar J, Möller J. Modeling using discrete event simulation: a report of the ISPOR-SMDM Modeling Good Research Practices Task Force-4. Value in Health. 2012;15(6):821-827. https://doi.org/10.1016/j.jval.2012.04.013
- National Institute for Health and Care Excellence. NICE technology appraisal and highly specialised technologies guidance: the manual (PMG36). London: NICE; published 31 January 2022, last updated 13 October 2026. https://www.nice.org.uk/process/pmg36
- Siebert U, Alagoz O, Bayoumi AM, Jahn B, Owens DK, Cohen DJ, Kuntz KM. State-transition modeling: a report of the ISPOR-SMDM Modeling Good Research Practices Task Force-3. Value in Health. 2012;15(6):812-820. https://doi.org/10.1016/j.jval.2012.06.014
Related Concepts (2)
Frequently Asked Questions (6)
What is conditional logic in a model?
Conditional logic is the set of if-then rules in a health economic model that make risks, costs or treatment depend on age, time, history or response.
Source: Siebert et al. 2012
What is an example of conditional logic in a model?
Conditional logic makes one part of a model depend on the value of another. A simple example is a rule that a patient incurs the cost and disutility of a side effect only if the branch representing that event has been followed, or that a treatment's effect applies only while the patient remains in a particular health state. Such rules let a model reflect that costs and outcomes are contingent on what has already happened rather than fixed. Briggs and colleagues (2006) illustrate this dependence.
Source: Briggs et al. 2006
How is conditional logic used in a decision model?
Conditional logic is used to make elements of a model depend on other elements, for example by setting a transition probability that differs by patient characteristic, applying a cost only when an event occurs, or directing a pathway according to an earlier outcome. It allows the model to represent that risks, costs, and events are not independent but conditioned on circumstances. By encoding these dependencies, conditional logic lets the model reflect realistic relationships rather than treating every element as fixed and separate.
Source: Briggs, Claxton & Sculpher 2006
Why is conditional logic important in modelling?
Conditional logic is important because real clinical and economic processes involve dependencies, where one event or characteristic changes the probabilities, costs, or paths that follow, and a model that ignored these would misrepresent them. Conditional logic captures such relationships, improving the model's realism. Errors in it, however, can introduce subtle mistakes that are hard to detect, since a dependency may be applied wrongly, so conditional logic is both a source of realism and a point requiring careful verification.
Source: Briggs, Claxton & Sculpher 2006
What errors can conditional logic introduce?
Conditional logic can introduce errors when dependencies are specified incorrectly: a condition applied to the wrong variable, a rule that fires under the wrong circumstances, or a dependency omitted or double-counted. Such errors may not be obvious, since the model still runs and produces plausible numbers, so they can distort results undetected. Because conditional logic governs how elements relate, mistakes in it can systematically bias outcomes, which is why it is checked carefully during model verification.
Source: Briggs, Claxton & Sculpher 2006
How is conditional logic verified?
Conditional logic is verified by tracing how variables and pathways respond to the conditions that should govern them, checking that dependencies fire under the right circumstances and produce the intended effects. Test cases with known inputs can be run to confirm that conditional relationships behave as designed, and extreme values can be used to see whether the logic responds sensibly. Such verification guards against dependency errors, which would otherwise bias results despite accurate individual parameters.
Source: Briggs, Claxton & Sculpher 2006
Trust Record
Verified by Dr Darrin Baines
British health economist
Professional identity: darrinbaines.org
Verification date: 20 Oct 2026
Content version: 1.0.3
Canonical Identity
- Persistent URI
- https://healtheconomics.wiki/concept/conditional-logic
- Term code
- HE-EM-DM-012
Stable URI · Machine-readable · Resolvable · CC BY 4.0
