Skip to content

Instantly share code, notes, and snippets.

View markrodonovan's full-sized avatar

markrodonovan

View GitHub Profile
@bschneidr
bschneidr / svy_prop_with_wilson_ci.R
Last active November 11, 2023 10:19
Wilson Confidence Interval for Complex Surveys
#' @title Wilson's confidence interval for complex survey designs
#' @description Calculate Wilson's confidence interval for a proportion,
#' with the effective sample size determined using a design-unbiased
#' estimate of the complex survey design effect.
#'
#' @param x A formula, vector, or matrix.
#' @param design A survey.design or svyrep.design object
#' @param na.rm Should cases with missing values be dropped?
#' @param level The confidence level required
#' @param ... Additional arguments to pass on to \code{svymean()}