Learn R Programming

nonprobsampling (version 0.1.0)

naive_mean_one_domain: Compute the naive mean for one domain

Description

Computes the unweighted sample mean and its variance for observations belonging to a single domain, identified by a 0/1 indicator vector.

Usage

naive_mean_one_domain(yvec, zvec = NULL)

Value

A list with components:

- `mean`: unweighted sample mean of `yvec` within the domain, or NA if the domain is empty. - `variance`: estimated variance of the mean (\(s^2/n\)), or NA if fewer than two observations are available.

Arguments

yvec

Numeric or integer outcome vector of length \(n\).

zvec

Integer 0/1 domain indicator of length \(n\), or NULL (treated as all-ones, i.e., the overall mean).