Code to run the seroprevalence model.
prev <- init_model_prev("prev", "sero_pos", datafit_prev, "sero_prev") asymp <- init_model_prev("asymp", "asymp_pos", datafit_asymp, "asymp") fit(prev) fit(asymp) clean_samples(prev) clean_samples(asymp) plot(prev, "Seroprevalence", "Fig1") # calls clean_samples(prev) plot(asymp, "Proportion Asymptomatic", "FigS1") # calls clean_samples(asymp)
Code to run the antibody kinetics model.
library(posterior) inter_start <- c("marginal_a_i", "marginal_e_i", "marginal_g_i", "marginal_s_i") slope_change <- c("marginal_a_s", "marginal_e_s", "marginal_g_s", "marginal_s_s") start <- init_model_ab_kin(name = "start", stan_file = "start", datafit = datafit_start, marginal_vars = inter_start, y_axis = "log(AU) at first bleed") change <- init_model_ab_kin(name = "change", stan_file = "change", datafit = datafit_change, marginal_vars = slope_change, y_axis = "Change in log(AU) after 28 days") # Run the mcmc sampler on these fits fit(start) fit(change) # Clean the mcmc samples clean_samples(start) clean_samples(change) clean_samples_revert(start, change) # Plot figs plot(start) plot(change) plot_revert(start, change) # Plot final figurre plot_figure_2(start, change, 8, 8)
Hetergeneous sensitivity and specficity model.
sens <- test_metric("Sensitivity", 60:100, datafit_seropos, `>`) spec <- test_metric("Specificity", 60:100, datafit_seroneg, `<`) fit(sens) fit(spec) plot(sens, 10, 10, "fig3_sens") plot(spec, 10, 10, "fig3_spec")
# Figure S1 plot_dates(10, 10) # Supp to model 2 plot_correlations(10, 10) plot_time_supp(10, 10) # Supp to model 3 plot_od_sens_curve(10, 10) plot_roc(10, 10) plot_roc_age(10, 10)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.