Use this Skill for health economic evaluation: cost-effectiveness analysis (ICER), Markov cohort models, QALY calculation, probabilistic sensitivity analysis, and cost-effectiveness planes.
Instalar com Codex ou Claude Copie este prompt, cole no Codex, Claude ou outro assistente e deixe que ele revise a página da skill e instale para você.
Um comando direto ignora o prompt de revisão. Verifique a origem antes de executá-lo.
Use this Skill for health economic evaluation: cost-effectiveness analysis (ICER), Markov cohort models, QALY calculation, probabilistic sensitivity analysis, and cost-effectiveness planes.
Health Economic Evaluation: Cost-Effectiveness Analysis
TL;DR — Implement full health economic evaluations: Markov cohort state
transition models with discounting, QALY calculation, PSA Monte Carlo simulation,
cost-effectiveness planes, and CEAC curves at multiple WTP thresholds.
When to Use
Use this Skill when you need to:
Estimate the ICER (Incremental Cost-Effectiveness Ratio) for a new intervention
Build a Markov cohort model comparing healthcare strategies over a time horizon
Calculate QALYs (Quality-Adjusted Life Years) from utility weights and dwell times
Conduct Probabilistic Sensitivity Analysis (PSA) with distributions on all parameters
Plot cost-effectiveness planes and Cost-Effectiveness Acceptability Curves (CEAC)
Evaluate interventions against WHO cost-per-DALY thresholds (1–3× GDP per capita)
Support decision making using the net monetary benefit (NMB) framework
Concept
Formula
ICER
ΔCost / ΔQALY
QALY
Utility × Time (years)
NMB
λ × ΔQALY − ΔCost
Discounted QALY
QALY_t × 1/(1+r)^t
Half-cycle correction
Add 0.5 cycle at start and end
Background
Cost-Effectiveness Analysis Framework
Health economic evaluation compares interventions on two dimensions simultaneously:
incremental costs and incremental health outcomes. The ICER is the ratio:
An intervention is considered cost-effective if its ICER falls below the
willingness-to-pay (WTP) threshold λ. Common thresholds:
UK (NICE): £20,000–£30,000 per QALY
WHO: 1–3× GDP per capita per DALY averted
USA: $50,000–$150,000 per QALY (no official threshold)
Markov Cohort Model
A Markov model represents disease progression as transitions between mutually
exclusive health states over discrete time cycles (typically 1 year):
States: Healthy → Sick → Dead
Transition matrix P (3×3):
P[i,j] = probability of moving from state i to state j in one cycle
Row sums must equal 1
Each state has associated costs (annual cost of being in that state) and
utility weights (health-related quality of life, 0=death, 1=perfect health).
Discounting
Future costs and QALYs are discounted to present value:
PV = Σₜ Value_t / (1 + r)^t
Standard discount rate: 3% per annum for both costs and outcomes (NICE, WHO).
Half-cycle correction shifts outcomes by half a cycle to account for events
occurring throughout the cycle rather than at the start.
Probabilistic Sensitivity Analysis
PSA replaces point estimates with probability distributions to characterize
parameter uncertainty:
Parameter Type
Distribution
Transition probabilities
Dirichlet or Beta
Utility weights
Beta (bounded 0–1)
Costs
Gamma (positive, right-skewed)
Log odds ratios
Normal
Each PSA iteration draws from all distributions simultaneously and re-runs
the model, producing a cloud of (ΔCost, ΔQALY) points on the CE plane.
import numpy as np
import matplotlib.pyplot as plt
defcompute_ceac(
delta_costs: np.ndarray,
delta_qalys: np.ndarray,
wtp_range: np.ndarray = None,
output_path: str = 'ceac.png',
) -> pd.DataFrame:
"""
Compute and plot the Cost-Effectiveness Acceptability Curve (CEAC).
The CEAC shows the probability that the intervention is cost-effective
at each willingness-to-pay (WTP) threshold λ.
CEAC(λ) = P(NMB > 0) = P(λ × ΔQALY − ΔCost > 0)
Args:
delta_costs: Array of incremental costs from PSA iterations.
delta_qalys: Array of incremental QALYs from PSA iterations.
wtp_range: Array of WTP thresholds to evaluate (£/QALY).
Default: 0 to 100,000 in steps of 1,000.
output_path: Path to save the CEAC plot.
Returns:
DataFrame with columns: wtp, prob_cost_effective.
"""if wtp_range isNone:
wtp_range = np.arange(0, 100_001, 1_000)
probs = []
for lam in wtp_range:
nmb = lam * delta_qalys - delta_costs
prob = float((nmb > 0).mean())
probs.append(prob)
ceac_df = pd.DataFrame({'wtp': wtp_range, 'prob_cost_effective': probs})
# Plot
fig, ax = plt.subplots(figsize=(9, 5))
ax.plot(wtp_range / 1000, probs, color='navy', linewidth=2)
ax.axhline(0.5, color='gray', linestyle=':', linewidth=1)
ax.axvline(20, color='red', linestyle='--', linewidth=1.2,
label='£20k/QALY (NICE lower)')
ax.axvline(30, color='orange', linestyle='--', linewidth=1.2,
label='£30k/QALY (NICE upper)')
ax.axvline(50, color='green', linestyle='--', linewidth=1.2,
label='$50k/QALY')
ax.set_xlabel('Willingness-to-Pay (£ thousands per QALY)')
ax.set_ylabel('Probability cost-effective')
ax.set_ylim(0, 1)
ax.set_title('Cost-Effectiveness Acceptability Curve (CEAC)')
ax.legend(fontsize=9)
ax.grid(True, alpha=0.3)
fig.tight_layout()
fig.savefig(output_path, dpi=150)
plt.close(fig)
# Report at key thresholdsfor threshold in [20_000, 30_000, 50_000, 100_000]:
row = ceac_df[ceac_df['wtp'] == threshold]
ifnot row.empty:
print(f"P(cost-effective) at £{threshold:,}: "f"{row['prob_cost_effective'].iloc[0]:.3f}")
return ceac_df
# --- Demo ---
ceac_df = compute_ceac(
psa_results['delta_costs'],
psa_results['delta_qalys'],
output_path='ceac_curve.png',
)
Advanced Usage
WHO Threshold Comparison
defwho_threshold_assessment(
country_gdp_per_capita: float,
icer: float,
currency: str = 'USD',
) -> dict:
"""
Assess cost-effectiveness against WHO thresholds (1× and 3× GDP per capita per DALY).
Args:
country_gdp_per_capita: GDP per capita in the given currency.
icer: ICER per QALY/DALY of the intervention.
currency: Currency label for display.
Returns:
Dict with threshold values and acceptability verdict.
"""
threshold_1x = country_gdp_per_capita
threshold_3x = 3 * country_gdp_per_capita
if icer <= threshold_1x:
verdict = 'Highly cost-effective (< 1× GDP per capita)'elif icer <= threshold_3x:
verdict = 'Cost-effective (1–3× GDP per capita)'else:
verdict = 'Not cost-effective (> 3× GDP per capita)'
result = {
'icer': round(icer, 2),
'gdp_per_capita': country_gdp_per_capita,
'threshold_1x': threshold_1x,
'threshold_3x': threshold_3x,
'verdict': verdict,
'currency': currency,
}
print(f"WHO threshold assessment: {verdict}")
print(f" ICER = {currency}{icer:,.0f} | 1× = {currency}{threshold_1x:,.0f} | 3× = {currency}{threshold_3x:,.0f}")
return result
Decision Tree Analysis
defdecision_tree(branches: list) -> dict:
"""
Simple decision tree expected value calculation.
Args:
branches: List of dicts: {name, probability, cost, qaly}.
Probabilities in each strategy must sum to 1.
Returns:
Dict with expected_cost and expected_qaly.
"""
total_prob = sum(b['probability'] for b in branches)
ifnot np.isclose(total_prob, 1.0):
raise ValueError(f"Branch probabilities must sum to 1 (got {total_prob})")
exp_cost = sum(b['probability'] * b['cost'] for b in branches)
exp_qaly = sum(b['probability'] * b['qaly'] for b in branches)
return {'expected_cost': round(exp_cost, 2), 'expected_qaly': round(exp_qaly, 4)}
Troubleshooting
Error
Cause
Fix
AssertionError: Rows must sum to 1
Transition matrix rows don't sum to 1
Normalize each row: P[i] = P[i] / P[i].sum()
ICER is negative
Intervention is dominant (lower cost, higher QALY)
Report as "Dominant" — negative ICER has no standard interpretation
PSA gives infinite ICER
delta_qaly ≈ 0 in some iterations
Use median ICER; filter np.isfinite(icers) before averaging
CEAC never reaches 1.0
High parameter uncertainty
Wider distributions; more PSA iterations
Dead state not absorbing
Transition matrix allows escape from Dead
Set P[dead, dead] = 1.0 and all other entries in that row to 0
Utilities > 1 after Beta sampling
Beta parameters set incorrectly
Verify Beta alpha and beta: mean = α/(α+β), must be ≤ 1