R/weighted_se.r

Defines functions weighted_se

Documented in weighted_se

#' @title weighted_se
#' @description Calculate weighted standard error of x using weights w.
#' @param x A numeric vector
#' @param w A numeric vector of weights
#' @param na.rm Logical indicating wheter NA's should be removed.
#'
#' @return The weighted standard error of x.
#' @export
#'

weighted_se <-
  function(x, w, na.rm = TRUE) {
    sqrt(weighted_var(x, w, na.rm = TRUE) / length(x))
  }
lina2497/alextools documentation built on June 7, 2020, 10:29 a.m.