Analysis scripts and supplementary files: Barriers to implementing clinical trials on non-pharmacological treatments in developing countries – lessons learnt from addressing pain in HIV


This repository contains analysis scripts (with outputs), figures from the manuscript, and supplementary files the HIV Pain (HIP) Intervention Study. All analysis scripts (and their outputs -- /outputs subdirectory) are found in, while PDF copies of the analysis outputs that are cited in the manuscript as supplementary material are found in the relevant supplement-*.pdf file.

Note: Participant consent did not provide for the publication of their data, and hence neither the original nor cleaned data have been made available. However, we do not wish to bar access to the data unnecessarily and we will judge requests to access the data on a case-by-case basis. Examples of potential use cases include independent assessments of our analyses, and secondary data analyses. Please contact Peter Kamerman (, Dr Tory Madden (, or open an issue on the GitHub repo (


Repository citation

Kamerman PR, Madden VJ, Parker R, Devan D, Cameron S, Jackson K, Reardon C, Wadley A. Analysis scripts and supplementary files: Barriers to implementing clinical trials on non-pharmacological treatments in developing countries – lessons learnt from addressing pain in HIV. DOI: 10.6084/m9.figshare.7654637.

Manuscript citation

Parker R, Madden VJ, Devan D, Cameron S, Jackson K, Kamerman P, Reardon C, Wadley A. Barriers to implementing clinical trials on non-pharmacological treatments in developing countries – lessons learnt from addressing pain in HIV. Pain Reports [submitted 2019-01-31]

Manuscript abstract

introduction: Pain affects over half of people living with HIV/AIDS (LWHA) and pharmacological treatment has limited efficacy. Preliminary evidence supports non-pharmacological interventions. We previously piloted a multimodal intervention in amaXhosa women LWHA and chronic pain in South Africa with improvements seen in all outcomes, in both intervention and control groups.

Methods: A multicentre, single-blind randomised controlled trial with 160 participants recruited was conducted to determine whether the multimodal peer-led intervention reduced pain in different populations of both male and female South Africans LWHA. Participants were followed up at Weeks 4, 8, 12, 24 and 48 to evaluate effects on the primary outcome of pain, and on depression, self-efficacy and health-related quality of life.

Results: We were unable to assess the efficacy of the intervention due to a 58% loss to follow up (LTFU). Secondary analysis of the LTFU found that sociocultural factors were not predictive of LTFU. Depression, however, did associate with LTFU, with greater severity of depressive symptoms predicting LTFU at week 8 (p=0.01).

Discussion: We were unable to evaluate the effectiveness of the intervention due to the high LTFU and the risk of retention bias. The different sociocultural context in South Africa may warrant a different approach to interventions for pain in HIV compared to resource-rich countries, including a concurrent strategy to address barriers to health care service delivery. We suggest that assessment of pain and depression need to occur simultaneously in those with pain in HIV. We suggest investigation of the effect of social inclusion on pain and depression.


These instructions are for running the analysis on your local machine.

You need to have Docker installed on your computer. To do so, go to ( and follow the instructions for downloading and installing Docker for your operating system. Once Docker has been installed, follow the steps below, noting that Docker commands are entered in a terminal window (Linux and OSX/macOS) or command prompt window (Windows). Windows users also may wish to install GNU Make ( (required for the `make` method of running the scripts) and Git ( version control software (not essential).

Download the latest image

Enter: docker pull kamermanpr/docker-hip-study:v2.0.0

Run the container

Enter: docker run -d -p 8787:8787 -v :/home/rstudio --name threshold -e USER=hip -e PASSWORD=study kamermanpr/docker-hip-study:v2.0.0

Where refers to the path to the HIP-study directory on your computer, which you either cloned from GitHub (, `git clone`, or downloaded and extracted from figshare (

Login to RStudio Server

- Open a web browser window and navigate to: `localhost:8787`

- Use the following login credentials:

- Username: hip

- Password: study

Prepare the HIP-study directory

The HIP-study directory comes with the outputs for all the analysis scripts in the _/outputs_ directory (html and md formats). However, should you wish to run the scripts yourself, there are several preparatory steps that are required:

1. Acquire the data. The data required to run the scripts have not been included in the repo because participants in the studies did not consent to public release of their data. However, the data are available on request from Peter Kamerman ( Once the data have been obtained, the files should be copied into a subdirectory named /data-original.

2. Clean the /outputs directory by entering `make clean` in the Terminal tab in RStudio.

Run the HIP-study analysis scripts

To run all the scripts (including the data cleaning scripts), enter `make all` in the Terminal tab in RStudio.

To run individual RMarkdown scripts (*.Rmd files)

1. Generate the cleaned data using one of the following methods:

- Enter `make data-cleaned/demographics.rds` in the Terminal tab in RStudio.

- Enter `source('clean-data-script.R')` in the Console tab in RStudio.

- Open the clean-data-script.R script through the File tab in RStudio, and then click the 'Source' button on the right of the Script console in RStudio for each script.

2. Run the individual script by:

- Entering `make outputs/.html` in the Terminal tab in RStudio, OR

- Opening the relevant \*.Rmd file through the File tab in RStudio, and then clicking the 'knit' button on the left of the Script console in RStudio.

Shutting down

Once done, log out of RStudio Server and enter the following into a terminal to stop the Docker container: `docker stop hip`. If you then want to remove the container, enter: `docker rm threshold`. If you also want to remove the Docker image you downloaded, enter: `docker rmi kamermanpr/docker-hip-study:v2.0.0`