GeezerVison is showing validate-hta.github.io — The HTA Verification Framework
1. Hierarchy of Testing in Health Economic Modelling
Testing can be performed at different levels of abstraction. Adapted
from the software engineering Test Pyramid framework (Cohn,
2009), automated checks in health economic modelling are organized into
three structural tiers:
-
Level 1: Unit Testing (Lowest Level — Fast, High
Isolation)
Isolates the smallest testable parts of an application
(“units”)—typically a single, self-contained helper function—and
verifies that they function correctly (e.g., a function that converts a
rate to a probability, applies a discount factor, or draws a parameter
sample).
-
Level 2: Integration Testing (Middle Level — Subcomponent
Interaction)
Verifies that multiple components (input structures, transition
matrices, simulation loops, and summary extractors) interact correctly
to produce logically sound results. Because health economic models
frequently lack a simple “test oracle” for complex multi-state traces,
executing run_model() under controlled boundary conditions
to check summary outputs like QALYs, Life Expectancy (LE), and ICERs
primarily operates at this integration level.
-
Level 3: System or End-to-End Testing (Highest Level — Full
Pipeline)
Executes the entire decision-analytic pipeline from raw data ingestion
to final policy outputs (e.g., running a 10,000-iteration Probabilistic
Sensitivity Analysis (PSA) pipeline to verify that it completes without
memory leaks, handles missing data gracefully, and outputs a valid ICER
and CEAC).
2. Why Use testthat Instead of Ad-Hoc Console
Checks?
The testthat package (Wickham, 2011) is the standard
framework for automated testing in R. To set up an R package or project
to use testthat (edition 3), run:
This creates the tests/testthat/ directory and
tests/testthat.R runner script. Automated checks in
testthat are written as expectations
(functions starting with expect_, such as
expect_equal(), expect_lt(),
expect_gt(), expect_true()) grouped inside
test_that("<description>", { ... }) blocks.
Unlike ad-hoc console checks using raw operators (== 0
or <), which return a generic FALSE or fail
silently unless manually inspected each time a script is run,
testthat expectations act as automated diagnostic tools.
When an expectation fails, testthat immediately flags the
exact test requirement ID, file, line number, and numerical discrepancy
between actual and expected values.
3. Health Economic Modelling Test Suite (T01 –
T12)
Table 1 below presents the standardized suite of 12 verification
tests, extreme-value checks, and logical assertions adapted from
established HTA quality-assurance frameworks:
- Internal consistency and extreme-value checks (McCabe & Dixon,
2000)
- Comprehensive “black-box” verification criteria (Tappenden &
Chilcott, 2014)
- Automated decision-analytic checking principles (Dasbach &
Elbasha, 2017)
- Technical verification standards reinforced by the CHEERS statement
(Husereau et al., 2013)
| ID |
Group |
Test Condition |
Expected Result |
| T01 |
Population |
Treatment effect the same for all treatments, e.g., Set
relative treatment effects (OR, HR, RR)
|
All treatments produce equal estimates of total LYGs
and total QALYs |
| T02 |
Population |
Set mortality rates (or corresponding transition
probabilities)
|
(assuming a fixed, finite time horizon to avoid an infinite loop) |
| T03 |
Population |
Set mortality rates (or corresponding transition
probabilities) to produce a probability of
|
(or
depending on within-cycle correction implementation) |
| T04 |
QALY |
Set discount rate
(assuming utility
for all living health states) |
Total QALYs equal LE |
| T05 |
QALY |
Set all living health state utility parameters
|
QALY gains exactly equal LYGs |
| T06 |
QALY |
Apply standard positive discount rate
vs.
rate |
|
| T07 |
QALY |
Set QALY discount rate
|
QALY gains after time
equal zero |
| T08 |
Cost |
Set intervention costs
|
ICER is
reduced
|
| T09 |
Cost |
Increase intervention costs |
ICER is
increased
|
| T10 |
Cost |
Set cost discount rate
|
Total costs equal the raw arithmetic sum of unadjusted
state costs
treatments (and discounted costs
undiscounted costs) |
| T11 |
Cost |
Set cost discount rate
|
Costs after time
equal zero |
| T12 |
Input |
Sample parameters from probabilistic distributions |
Range of sampled values does not violate distribution
boundaries, NaNs, or critical numerical precision
errors |
Note on ICER Directionality (T08 &
T09): Assuming a controlled test environment where
baseline Incremental Effects
()
are known to be strictly positive
().
In testthat, this assumption can be guarded explicitly
using testthat::skip_if_not(inc_qalys > 0, ...). If
evaluating a scenario with negative incremental health effects, the
verification logic should isolate Incremental Costs
()
instead.
Note on Within-Cycle Correction (T03):
In models applying a standard half-cycle (or within-cycle) correction,
setting mortality to
in the first cycle will conceptually result in a life expectancy of
cycles rather than
cycle.
References
-
Cohn, M. (2009). Succeeding with Agile:
Software Development Using Scrum. Addison-Wesley Professional.
-
Wickham, H. (2011). testthat: Get Started with
Testing. The R Journal, 3, 5–10.
-
McCabe, C., & Dixon, S. (2000). Testing the
Validity of Cost-Effectiveness Models. PharmacoEconomics,
17(5), 501–513.
-
Tappenden, P., & Chilcott, J. B. (2014).
Avoiding and Identifying Errors and Other Threats to the Credibility of
Health Economic Models. PharmacoEconomics, 32, 967–979.
-
Dasbach, E. J., & Elbasha, E. H. (2017).
Verification of Decision-Analytic Models for Health Economic
Evaluations: An Overview. PharmacoEconomics, 35, 673–683.
-
Husereau, D., et al. (2013). Consolidated Health
Economic Evaluation Reporting Standards (CHEERS) Statement. European
Journal of Health Economics, 14(3), 367–372.
|