Skip to content
Steve Bellan edited this page Jan 30, 2015 · 13 revisions

Welcome to the AcuteRetroSim wiki!

This wiki provides the supporting R code and data for the following manuscript:

Bellan SE, Dushoff J, Galvani AP, Meyers LA (in press). Re-assessment of HIV-1 acute phase infectivity: adjusting for biases with simulated cohorts. PLOS Medicine.

(A) Simulating & analyzing Rakai retrospective cohorts

This section simulates cohorts of 100,000 couples for a specified amount of inter-individual heterogeneity in the risk of infection and a specified infectivity profile over the course of disease progression. Retrospective cohorts of couples observe serodiscordance at least once and then followed up at least once are then identified from this couple's cohort and analyze using the Wawer et al. (2005) and Hollingsworth et al. (2008) approaches.

##1 Generating couple relationship histories

  • CopulaRelationshipModel-FigS1.R fits multivariate normal copula models to five relationship history variables from the Ugandan AIS 2004-2005 and DHS 2011 surveys (time of sexual activity before couple formation for both partners, date of couple formation, age of each partner at sexual debut)

  • Inputs required: Uganda AIS/DHS data (UgandaDHS2011.Rdata), UNAIDS prevalence curves (epic.Rdata), Weibull survival curve fit to CASCADE data (csurv.Rdata), estimated transmission rates from fitting couples model to DHS data (see Bellan et al. (2013); pars.arr.ac.Rdata)

  • Note: 2004-2005 AIS not provided in this repository because it is restricted, please contact the Ugandan Ministry of Health for access. Nearly identical results can be achieved using just the 2011 DHS data set.

##2 Simulating couple cohorts

  • SimulationFunctions.R provides several flexible functions for simulating cohorts of couples with relationship histories characteristic of Uganda (see step one above).

  • SimulationStarter.R sources these functions, and for a set of input parameters simulates a cohort.

  • RakMK.R builds a control file to send to the cluster to run several thousand simulations, each with different hazard profiles across the various disease stages (acute, chronic, late, AIDS) and different amounts of heterogeneity.

  • The control file RakAcute.txt is then submitted to the cluster (in our case Lonestar at the Texas Advanced Computing Center), which runs the simulations and stores the results in the specified directory set up.

##3 Simulating and analyzing retrospective cohorts

  • RakaiCohortSimulator.R takes as input a simulated couple population from above and reduces it to a retrospective cohort using the same study design as the original Rakai retrospective cohort.

  • This same script also applies the Wawer et al. (2005) and Hollingsworth et al. (2008) analyses to the retrospective cohort generated either from a simulated couple population or from the original data set.

  • The functions used to both generate and analyze retrospective cohorts are sourced from RakFunctions.R. this script also creates the original Rakai data set.

  • FitRakMK.R creates a control file (FitRak.txt) to be sent to the cluster, with a call to RakaiCohortSimulator.R for each simulation created in step #2 above.

  • RakaiCohortSimulator.R can also generate a retrospective cohorts using the Hollingsworth model (i.e. because this is a fully specified probability model, we can also use it to generate data). HollTestFit.R creates a control file to be submitted to the cluster that will both simulate cohorts using the Hollingsworth model and also fit them with the Hollingsworth model.

##4 ABC-SMC fit of model to Rakai data

  • abcFunctions.R houses the functions used for ABC-SMC, including the priors, particle simulation from the priors, particle weighting, particle perturbation kernels, a simulation function (retroCohSim) that takes a particle and produces a data table to comparable to the Rakai data set (using functions from RakFxns.R), and several functions to compute summary statistics for comparison of those to the original data (i.e. based on S2 Fig.).

  • ABCsimStarter.R starts a batch of simulations to send to a cluster (i.e. continues to simulate particles, their resulting data sets, and resulting summary statistics for a specified amount of time).

  • abcMK.R creates a submission script of command lines to send to the cluster to call ABCsimStarter.R

  • abcSummary.R collects a batch of ABC results & prepares particle weighting for the next batch as well as does some diagnostics on the intermediate distribution.

  • abcPlotPoster.R plots posterior results for manuscript as well as summarizes intermediate distributions.

  • ExclCoupleDistr.R summarizes # and proportion of couples excluded from both ABC-SMC fit and simulation analyses.

##5 Interpreting simulation analysis results

  • RakFitSummary.R compiles both the Wawer and Hollingsworth Model fits to each simulation produced by the submission of FitRak.txt to the cluster.

  • It also creates comprehensive plots showing the estimated vs. true EHMacute for all parameters simulated including both median and confidence/credible intervals. These plots help build intuition for the results but are not given in the final manuscript because of their complexity.

  • Instead, TrueVsEst-Fig4.R creates Figure 4, a more easily understandable summary of the four different biases that affect these estimation processes.

  • revisedCIs-Fig5.R then creates figure 5, i.e. our revised confidence intervals on EHMacute.

  • NonIdent-Fig1.R creates figure 1, which shows how our re--fit of Hollingsworth's model to the Rakai retrospective cohort data gives slightly different results and how the duration and relative infectivity of the acute phase are collinear.

  • HollModFitSummary-FigS3.R creates figure S3. This figure shows the results of fitting the Hollingsworth model to data generated by the Hollingsworth model in comparison to data generated by a couples transmission model, with the retrospective cohort identified after the fact.

(B) Expected EHMacute based on viral loads

  • VLinfectivity-Fig3.R loads data from several papers on viral load-infectivity relationships and also on acute phase viral load measurements. These data are then plotted together to produce figure 3 which also shows how the relative hazard (compared to the chronic phase) should change over time is a function of viral load. The excess hazard-months attributable to the acute phase (EHMacute) can then be seen visually as the area under the relative hazard profile above a relative hazard of one.