inf_hist_prop_prior_v3: Infection history proposal function

View source: R/RcppExports.R

inf_hist_prop_prior_v3R Documentation

Infection history proposal function

Description

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.

Usage

inf_hist_prop_prior_v3(
  infection_history_mat,
  sampled_indivs,
  age_mask,
  sample_mask,
  proposal_inf_hist_distances,
  n_infs,
  shape1,
  shape2,
  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

shape1

double, shape1 (alpha) parameter of the beta binomial

shape2

double, shape2 (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++

strain_mask

IntegerVector, for each individual gives the last column in the infection history matrix that an individual could have been exposed to indexed from 1. ie. if their last serum sample was in the 40th epoch, entry would be 40

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()


seroanalytics/serosolver documentation built on Dec. 14, 2024, 5:33 a.m.