# Individual level data

**R on Gianluca Baio**, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)

Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

## Cost-effectiveness analysis with individual level data

You can do this practical either directly in `BUGS`, or running the scripts from `R`. If you are using the `BUGS` graphical interface, then you will need to open the relevant model files (e.g. `normal-mod.txt`}, `cgeg-mod.txt`), together with the relevant data (e.g. `cost-data.txt` or `cost-util-data.txt`). Notice that for these models it is important to specify suitable initial values (particularly for the Gamma-Gamma specification), or else `BUGS` may struggle to start the simulations. Conversely, if you are working directly in `R`, you can follow the script `IPD_analysis.R`}, which will guide you through the several steps and analyses required.

Analyse the cost data for the two arms of the trial. The relevant

`BUGS`model is coded in the file`normal-mod.txt`. Make sure you understand the code and then run it using the data stored in`cost-data.txt`. Costs are in £1000s, so that`OpenBUGS`does not “overflow” during calculations with large numbers. The initial values are stored in the files`normal-inits1.txt`,`normal-inits2.txt`,`normal-inits3.txt`(if you want to use 2 chains, you can select either two of these three).Monitor the relevant nodes (decide based on your understanding of the model and the questions below. The

`R`scripts can give you some hints if you are undecided).What is the mean cost in each arm and the mean difference in costs between arms? (The

`R`script also has a few more commands to manipulate the output of your simulations and produce more sophisticated and useful analyses).

In the file

`normal-mod.txt`, some code is included to calculate the deviance, a measure of model fit. The quantity -2\(\times\)log likelihood of a normal distribution is written out in`BUGS`model code.Re-run the model, this time making sure you monitor the relevant nodes associated with the deviance analysis (you can skip this part if you have already monitored all the relevant nodes).

What is the deviance of the model, using this method?

Find the deviance by setting a monitor for the variable deviance.

Find the deviance using the DIC feature from the menus in

`OpenBUGS`. .

Make sure the answers from methods b, c and d match.

Now analyse the cost and utility data for the two arms of the trial. The relevant

`BUGS`model is coded in the file`cgeg-mod.txt}. Inspect it and check the``BUGS`code makes sense.Using the data in

`cost-util-data.txt`and the initial values in the files`cgeg-inits1.txt`,`cgeg-inits2.txt`,`cgeg-inits3.txt`(if you want to use 2 chains, you can select either two of these three), run the model. If you are using`BUGS`, update the model for 1000 iterations. Monitor at least the nodes`delta.e`,`delta.c`,`INB`and`CEAC`. Then update the model for a further 3000 iterations.Plot the cost-effectiveness plane. .

What are the point and 95% interval estimates for the Incremental Net Benefit (INB), when the willingness-to pay is £500 per day saved in hospital? Is this consistent with the values of

`delta.e`and`delta.c`_(Hint: Find the appropriate`j`from`K[j] = (j-1)*K.step`, in your model code. The`R`file has more sophisticated code to do this)_.What is the probability that the intensive treatment (arm 2) is cost-effective for a willingness-to-pay of £500 per day saved in hospital?

*\textit{*(Hint: the`R`script shows all the necessary steps to compute numerically this probability. In the`BUGS`interface, you could modify the model code to get this number, or you could simply use the density of the relevant`INB`to assess this visually)._Draw a cost-effectiveness acceptability curve.

*(Hint:*.**Inference \(\Rightarrow\) Compare**, enter`CEAC`for**node**and`K`for**axis**, and click on**scatter**.**Right-button-click on the graphics \(\Rightarrow\) Properties**. Explore the options to get a nice CEAC. The`R`script does this with more sophistication)

**leave a comment**for the author, please follow the link and comment on their blog:

**R on Gianluca Baio**.

R-bloggers.com offers

**daily e-mail updates**about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.

Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.