# Another bunch of R (and JAGS) scripts

Probably sooner than I expected, I have managed to also upload the codes for the examples in Chapter 5 of the book, which deals with *doing* Bayesian health economic evaluations. Basically, there are 3 examples, which sort of represent the main classes of cases (of course there are many, many other types of models that can be used and these are **by no means** exhaustive. But if you learn to do these, you can start working in health economics with reasonable confidence…).

**1.** The first example assumes individual data (eg, but not necessarily, from RCTs) on the pair of variables \((e,c)\), representing a suitable measure of effectiveness (eg, but not necessarily, QALYs) and cost. The tricky part is that, as seems reasonable, these two quantities will tend to be correlated. This of course needs to be accounted for when modelling the data, with the added complication that neither can usually be associated with Normal distributions. Sometimes it is possible to make transformations to approximately reach normality, but there is still the issue of correlation. One easy-ish way of dealing with this (especially if you’re a Bayesian) is to de-compose the joint distribution \(p(e,c\mid\boldsymbol\theta)\) as the product \(p(c \mid e,\boldsymbol\phi) p(e \mid \boldsymbol\psi)\), effectively using a regression specification. The examples provide the same structure for different distributional choices and I’ll soon post some variations based on mixture models to better account for the possibility that some individuals have observed null costs (for example, subjects among the controls that happen to require no extra care at all).

**2.** The second example deals with evidence synthesis, ie the situation where there is composite evidence coming from different sources, that can be combined to estimate several parameters of interest.

In this case (see the graph), I consider a model that has \(H\) studies estimating the probability of infection with influenza, which via a hierarchical model is given by \(p_0\). Moreover, there are other \(S\) studies investigating the effectiveness of some treatment, which again via hierarchical modelling is given by \(\rho\). Then these two can be put together to estimate the probability of infection for the subjects treated with the prophylactic drug as \(p_1=f(p_0,\rho)\), for a suitable function \(f(\cdot)\).

**3.** In a way this is the king of health economic evaluation methods, since increasingly often people use Markov models (MMs) to do their cost-effectiveness analysis.

The idea is to model the transitions of a cohort of individuals among a set of “states”. Initially, we can assume that everybody is healthy; then, as time progresses and according to some *transition probabilities *(ie the quantities that are normally to be estimated, indicated as \(\lambda_{hk}\) in the graph above, for the transition from \(h\) to \(k\)), they start to move around and eventually (if the model is so-called “life-long”) they all die. The example in the book is not too complicated and MMs can be quite tricky to run (just like the HPV model we’re trying to extend). But I think it gives a (slightly more than) basic idea of how they should work.