Skip to content

jsheen/netVax

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

netVax

Simulation study to identify indirect protection of vaccination with a transmissible vaccine. Accompanies Sheen, Kennedy-Shaffer, Levy, Metcalf (2025) Design of field trials for the evaluation of transmissible vaccines in animal populations.

shinyTrans

  • app.R: Code for Shiny app to get required sample sizes of trials comparing transmissible vaccines to traditional vaccines. The app is available at https://j-k-s.shinyapps.io/shinyTrans/
  • This code can be adapted to include further estimands and estimators of interest. Within app.R, in the function getSampSize(), final sizes are obtained using the helper functions getFinalSize() and getDiffFinalSize(). One could define estimands of interest using these final sizes calculated much as we have done to define our causal and statistical estimands (there are comments for each estimand within the R script). The estimand can then be supplied in the return argument of getSampeSize() and pasted into the HTML script to display the result at the bottom of the function renderPlot().

code/twostage/

The following are scripts used to obtain the required sample sizes through simulation. The workflow is: first obtaining necessary preliminary parameters based on user-input parameters using the files in the folder "prelim." Next, simulated epidemics for clusters of animals are created and information saved with the files in "sim/revision." The simulated epidemics for clusters of animals are then analyzed using the files in "analysis/revision." Figures pertaining to the paper are created using the files in "figs."

prelim:

  • Scripts used to create preliminary data, i.e., transmission rate that corresponds to the input R0 for each type of network structure. getPrelim_SEIR_Pois.py obtains these parameters when the contact structure is Poisson distributed while getPrelim_SEIR.py obtains these parameters when the contact structure is overdispersed (k=1).
  • Within each script the user supplies a vector of the following parameters (1) Ns: the number of animals within each cluster (2) overdispersions: the parameter k to parameterize the amount of overdispersion (3) R0s: the R0 of the wildtype pathogen. All combinations of these user supplied parameter vectors are then created.
  • There is one main function of each script, "getPrelim" that will obtain the preliminary data. First it finds the median transmission that leads to the desired R0 across 2000 simulated networks. Then it will find the day on average when 0.05% of the population is actively infected across 2000 simulated networks. Then it will write down the transmission rate and day into a preliminary file.

sim/revision:

  • Scripts used to create simulation bank for analysis when comparing transmissible vaccine to traditional vaccine. sim_twostage_SEIR_antici_revision.py creates simulations for overdispersed contact structures where trials are anticipatory, sim_twostage_SEIR_Pois_antici_revision.py creates simulations for Poisson contact structures where trials are anticipatory, and sim_twostage_SEIR_Pois_revision.py creates simulations for Poisson contact structures where trials are reactionary.
  • For each script, users can specify the following epidemiological parameters for the set of simulations they wish to create: (1) number of animals per cluster (2) R0 of the wildtype pathogen (3) R0 of the vaccine (4) vaccine efficacy (5) percentage initially vaccinated (6) whether the vaccine is traditional or transmissible (7) number of simulations users wish to create (8) overdispersion parameter k for overdispersed contact networks.
  • For each script, there is one main function "runSim" which will run one simulated epidemic for a single cluster. First it will read in the preliminary data of the transmission rate to use, as well as the date to interrupt the simulation in the case of reactionary trials. For each simulation, it will create a new simulated network, then run a simulation of transmission. For anticipatory trials, it will first simulate transmission of the vaccine, then simulate transmission of the wildtype, and finally write the results at follow-up. For reactionary trials it will first simulate transmission of the wildtype until the day to interrupt the simulation, then add in the transmissible vaccine and simulate until day of follow-up (writing the results thereafter).
  • The function "runSim" is run in parallel across the number of cores - 1 that the user supplies. After supplying the user input parameters, the user can run the entire script in an IDE as is.

analysis/revision:

  • Scripts used for analysis of simulation data comparing transmissible vaccine to traditional vaccine. These file obtains the required sample sizes using the simulation bank generated by the files in code/twostage/sim. Each file is named as (Poisson contact structure or "" for overdispersed contact structure)_antici_(Estimand of interest).R.
  • Within each script the following parameters can be set by the user: (1) N_sims: number of cluster simulations in the simulation bank (see sim/revision) (2) N_sample: number of animals to sample from each cluster (3) N_trials: number of trial simulations to conduct (4) n_perm: number of permutations for the null distribution of the hypothesis test when the number of clusters of the simulated trial is greater than 12 (5) cutoff: day of follow-up after start of epidemic (6) alpha: significance level of hypothesis test (7) num_bootstrap_sample: number of resamples to make up bootstrap (8) assignment_mechanisms: assignment mechanisms of each arm. Set as (percentage vaccinated [0 or 0.05])_(vaccine type [trad. or trans.]) (9) N_assignment_mechanism_sets: number of clusters for each arm of the trial (10) R0_vax: R0 of the vaccine if transmissible (11) vaxEff: vaccine efficacy (12) threshold_inclusion: if the number of sampled infections is below this number, exclude from analysis
  • There is one main function of each script, "run_trial" which will run the trial simulation. N_sample are sampled from each cluster, and the estimate is calculated based on the sample for the estimand of interest using the function "calc_est". A permutation test is then conducted, either an exact test when 12 or less clusters are recruited for the trial, or a permutation test with 1000 permutations otherwise. A bootstrap sample is then calculated for the estimate.
  • The function "run_trial" is run in parallel across the number of cores - 1 that the user supplies. After supplying the user input parameters, the user can run the entire script in an IDE as is.
  • Please note that in these files, Delta4 is synonymous with Theta1 and Delta5 is synonymous with Theta2

figs:

  • These are scripts used to create Figures 2, 3, and S3. Fig2Pois_antici.py, Fig2Pois.py, Fig2Over_antici.py corresponds to the left, middle, and right panels of Figure 2. fig3.R creates all three panels of Figure 3. figS3.R creates both panels of Figure S3. Further information found within each script.

code_output/

figs:

  • Figures 2, 3, and S3

prelim:

  • Preliminary data necessary for simulations, i.e., transmission rate that corresponds to the input R0 for each type of network structure. See above section "code/twostage/prelim" for more details.

twostage/rData:

  • All output files by scripts in code/twostage/analysis. See above section "code/twostage/analysis/revision" for more details.

twostage/sims:

  • All simulations output by scripts in "code/twostage/sim"

These programs are a work in progress, as we work to improve usability, error-catching, and speed of analysis. If you find errors, please contact Justin Sheen at jsheen (at) princeton (dot) edu.

Last Update: February 3, 2025

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published