Skip to contents

The Hajek mean \(\sum w y / \sum w\) and the Taylor-linearisation SE under the design (strata, clusters, finite-population correction), as survey::svymean computes them. A missing value in the variable gives NA, as there.

Usage

morie_survey_mean(design, variable)

Arguments

design

A design from morie_survey_design(). A survey::svydesign object is accepted too and read into the same native form (one-stage designs).

variable

Character; column name of the outcome variable in the design object (morie_survey_mean).

Value

A named list: mean, se.

Examples

set.seed(1)
df <- data.frame(y = rnorm(40), w = runif(40, 0.5, 2))
d <- morie_survey_design(df, "w")
str(morie_survey_mean(d, "y"), max.level = 1)
#> List of 2
#>  $ mean: num 0.0735
#>  $ se  : num 0.168