#' Calculate ESS
#'
#' Calculates effective sample size from a vector of weights
#'
#' @param w Vector of weights
#'
#' @return Effective sample size
#' @export
ess <- function(w) {
length(w) * mean(w)^2 / mean(w^2)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.