% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/variance.R
\name{wf_variance}
\alias{wf_variance}
\title{Combine replicate weights and an estimator into a variance and CI.}
\usage{
wf_variance(
  replicates,
  estimator,
  data,
  level = 0.95,
  ci = c("normal", "percentile")
)
}
\arguments{
\item{replicates}{A \code{wf_replicate_weights} object.}

\item{estimator}{A closure \verb{function(weights, data) -> numeric} (scalar or
named vector).}

\item{data}{The data frame the estimator reads.}

\item{level}{Confidence level in \verb{(0, 1)}.}

\item{ci}{Interval type: \code{"normal"} or (bootstrap only) \code{"percentile"}.}
}
\value{
A \code{wf_variance_result} object.
}
\description{
Applies the unified replication rule
\verb{Var = scale * sum_r rscales_r * (theta_r - theta)^2} to any estimator, using
the \verb{(scale, rscales)} stored by \code{\link[=wf_replicates]{wf_replicates()}}.
}
