Proposes a new matrix of infection histories using a beta binomial proposal distribution. This particular implementation allows for n_infs epoch times to be changed with each function call. Furthermore, the size of the swap step is specified for each individual by proposal_inf_hist_distances.

inf_hist_prop_prior_v3(
  infection_history_mat,
  sampled_indivs,
  age_mask,
  strain_mask,
  proposal_inf_hist_distances,
  n_infs,
  alpha,
  beta,
  rand_ns,
  proposal_inf_hist_indiv_swap_ratio
)

Arguments

infection_history_mat

and RcppArmadillo matrix of infection histories, where rows represent individuals and columns represent potential infection times. The contents should be a set of 1s (presence of infection) and 0s (absence of infection)

sampled_indivs

IntegerVector, indices of which individuals to resample. Note that this is indexed from 1 (ie. as if passing straight from R)

age_mask

IntegerVector, for each individual gives the first column in the infection history matrix that an individual could have been exposed to indexed from 1. ie. if alive for the whole period, entry would be 1. If alive for the 11th epoch, entry would be 11.

proposal_inf_hist_distances

IntegerVector, how far can a swap step sample from specified for each individual

n_infs

IntegerVector, how many infections to add/remove/swap with each proposal step for each individual

alpha

double, alpha parameter of the beta binomial

beta

double, beta parameter of the beta binomial

rand_ns

NumericVector, a vector of random numbers for each sampled individual. The idea is to pre-specify whether an individual experiences an add/remove step or a swap step to avoid random number sampling in C++

Value

a matrix of 1s and 0s corresponding to the infection histories for all individuals

See also

Other infection_history_proposal: inf_hist_prop_prior_v2_and_v4()