## SKG
## February 26, 2020
## Getting importance sampling to work based on empirical distributions
#' Get empirical weights from a pre-computed table
#'
#' @param n cluster size
#' @param x number of positive smears in the cluster
#' @param number of positive transmissions
#' @param tab_list list of tables with pre-computed probabilities
#' @return probability of i positive given n,x
get_weights_from_table <- function(n, x, i_pos,
tab_list = TBornotTB::idistrib1e4){
# browser()
tab <- tab_list[[n]][x + 1,]
probs <- tab[i_pos + 1] / sum(tab)
return(probs)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.