All functions

add_measurement_shifts()

Add measurement shifts to predictions

add_noise()

Add noise

bb_mean()

Beta binomial mean

bb_var()

Beta binomial variance

calculate_infection_history_statistics()

Get posterior information infection histories

calc_phi_probs()

Calculate FOI log probability

calc_phi_probs_indiv()

Calculate FOI log probability vector

calc_phi_probs_spline()

Calculate FOI from spline - INACTIVE

check_attack_rates()

Checks the attack_rates supplied in simulate_data

check_data()

Checks the entries of data used in serosolver

check_inf_hist()

Check infection history matrix

check_par_tab()

Check par_tab for simulate_data

check_proposals()

Checks if the multivarite proposal is being used with the FOI proposal

create_age_mask()

Create age mask

create_cross_reactivity_vector()

Convert melted antigenic map to cross reactivity

create_posterior_func()

Posterior function pointer

create_prior_mu()

Create strain specific bias prior

create_prob_shifts()

Measurement shift creation

create_strain_mask()

Create strain mask

cs1_chains_real

MCMC chains case study 1, real

cs1_chains_real_b

MCMC chains case study 1, real, for sim

cs1_chains_sim

MCMC chains case study 1, sim

cs2_chains_real

MCMC chains case study 2, real

cs2_chains_real_b

MCMC chains case study 2, real, for sim

cs2_chains_sim

MCMC chains case study 2, sim

db()

Beta prior on an infection

dbb()

Beta binomial density

dbb_prior()

Beta binomial prior used here (no choose constant)

density_beta_binom()

Beta binomial density

describe_priors()

Describe infection history priors

estimate_mode()

Estimate vector mode

example_antigenic_map

Example antigenic map

example_inf_chain

Example MCMC chain for infection histories

example_inf_hist

Example infection history matrix

example_par_tab

Example parameter table

example_theta_chain

Example MCMC chain for kinetics parameters

example_titre_data

Example titre data

expand_summary_infChain()

Expand sparse infection history matrix

expand_summary_inf_chain()

Expands default MCMC saved inf_chain

find_bb_2()

Beta binomial parameter match

find_beta_prior_mode()

Find Beta distribution parameters with mode

find_beta_prior_with_mean()

Find beta parameters with maximum variance

find_beta_prior_with_mean_var()

Find beta parameters for mean and variance

find_prior_alpha_beta()

Beta binomial parameters

fit_beta_prior()

Fit beta distribution to MCMC output

fit_normal_prior()

Fit normal distribution to MCMC output

fromUnitScale()

Convert from unit scale to original scale

generate_antigenic_map()

Generate antigenic map

generate_antigenic_map_flexible()

Generate antigenic map, flexible

generate_ar_annual()

Generates attack rates from an SIR model with fixed beta/gamma, specified final attack rate and the number of time "buckets" to solve over ie. buckets=12 returns attack rates for 12 time periods

generate_cumulative_inf_plots()

Plot cumulative and per time posterior infection probability densities

generate_phis()

Generate FOI phis - INACTIVE

generate_quantiles()

Formatted quantiles

generate_start_tab()

Generate starting parameter table

gen_spline_y()

Generates a spline for generate_phis - INACTIVE

get_best_pars()

Best pars

get_DOBs()

Get DOBs

get_index_pars()

Index pars

get_n_alive()

Get number alive

get_n_alive_group()

Get number alive by location

get_titre_predictions()

Generate titre credible intervals

get_total_number_infections()

Get total number of infections

hist_rbb()

Beta binomial histogram

infection_history_prior()

Beta binomial infection history prior

infection_history_symmetric()

Brute force infection history proposal

inf_hist_prop_prior_v2_and_v4()

Infection history gibbs proposal

inf_hist_prop_prior_v3()

Fast infection history proposal function

inf_hist_swap()

Swap infection history years

inf_hist_swap_phi()

Swap infection history years with phi term

inf_mat_prior()

Infection history prior R

inf_mat_prior_cpp()

Marginal prior probability (p(Z)) of a particular infection history matrix single prior Prior is independent contribution from each year

inf_mat_prior_cpp_vector()

Marginal prior probability (p(Z)) of a particular infection history matrix vector prior Prior is independent contribution from each year, but each year has its own alpha and beta

inf_mat_prior_group_cpp()

Marginal prior probability (p(Z)) of infection history matrix with groups Prior is independent contribution from each year and group

inf_mat_prior_group_cpp_vector()

Marginal prior probability (p(Z)) of a particular infection history matrix vector prior by group Prior is independent contribution from each time, but each time has its own alpha and beta

inf_mat_prior_total_group_cpp()

Marginal prior probability (p(Z)) of a particular infection history matrix total prior Prior here is on the total number of infections across all individuals and times

likelihood_func_fast()

Fast observation error function Calculate the probability of a set of observed titres given a corresponding set of predicted titres. FAST IMPLEMENTATION

load_antigenic_map_file()

Read in antigenic_map

load_infection_chains()

Load MCMC chains for infection histories

load_mcmc_chains()

Combine theta and infection history chains

load_start_tab()

Read in start_tab

load_theta_chains()

Load MCMC chains for theta

load_titre_dat()

Read in titre_dat

melt_antigenic_coords()

Create useable antigenic map

mvr_proposal()

Multivariate proposal function

pad_alphas_and_betas()

Pad par_tab with alpha and betas

pad_inf_chain()

Pad infection history chain

pbb()

Beta binomial distribution function

plot_attack_rates()

Plot historical attack rates

plot_attack_rates_monthly()

Plot historical attack rates monthly

plot_data()

Useful plot for looking at simulated data

plot_infection_histories()

Plots infection histories and titre model fits

plot_infection_history_chains_indiv()

Plot MCMC trace for infections per individual

plot_infection_history_chains_time()

Plot MCMC trace for infections per year

plot_number_infections()

Plot point range number infections per individual

plot_posteriors_infhist()

Plot inferred posteriors infection histories

plot_posteriors_theta()

Plot inferred posteriors theta

plot_samples_distances()

Plot time between serum samples

plot_total_number_infections()

Total number of infections

prob_mus()

Prior probability of strain specific boosting

prob_shifts()

Prior on measurement shifts

protect()

Protect function

qbb()

Beta binomial quantile function

rbb()

Beta binomial random generation

rm_scale()

Robins and Monro scaler, thanks to Michael White

serosolver()

Adaptive Metropolis-within-Gibbs/Metropolis Hastings Random Walk Algorithm.

r_likelihood()

Likelihood function given data

save_infection_history_to_disk()

Write given infection history to disk

scaletuning()

Scale step sizes

setup_infection_histories()

Propose initial infection histories

setup_infection_histories_old()

Propose initial infection histories - OLD VERSION

setup_infection_histories_titre()

Propose initial infection histories based on titres - use this!

setup_infection_histories_total()

Initial infection history prior on total

setup_titredat_for_posterior_func()

Setup titre data indices

simulate_attack_rates()

Simulate attack rates

simulate_cross_sectional()

Simulates multiple cohorts in a cross-sectional framework.

simulate_data()

Simulate full data set

simulate_group()

Simulate group data

simulate_individual()

Simulate individual data

simulate_individual_faster()

Simulate individual data quickly

simulate_infection_histories()

Simulate infection histories

subset_nullable_vector()

Takes a subset of a Nullable NumericVector, but only if it isn't NULL

sum_buckets()

Sums a vector based on bucket sizes

sum_infections_by_group()

Count infections by group and time

sum_likelihoods()

Sum likelihoods into buckets

titre_data_fast()

Overall model function, fast implementation

titre_dependent_boosting_plot()

Titre dependent boosting relationship

to.pdf()

PDF - Rich's function to print to device without potential for bad errors

to.png()

PNG - Rich's function to print to device without potential for bad errors

to.svg()

SVG - Rich's function to print to device without potential for bad errors

toUnitScale()

Convert to unit scale

univ_proposal()

MCMC proposal function

wane_function()

Function to calculate non-linear waning All additional parameters for the function are declared here