Skip to contents

Subpopulation (domain) mean with Woodruff linearised SE.

Usage

morie_survey_subpop(df, domain_col, domain_value, outcome_col, weight_col)

Arguments

df

A data.frame holding the (unit-level) sample data plus any weight/strata/cluster/domain columns referenced by name.

domain_col

Character; column name of the subpopulation / domain indicator in df.

domain_value

Value (matching df[[domain_col]]) defining the subpopulation to estimate.

outcome_col

Character; column name of the outcome variable in df.

weight_col

Character; column name of the design weight variable in df.

Value

A named list with elements mean, se, ci_lower, ci_upper, n_domain.

Examples

set.seed(1)
df <- data.frame(y = rnorm(40), g = rep(c("a", "b"), 20),
                 w = runif(40, 0.5, 2))
str(morie_survey_subpop(df, "g", "a", "y", "w"), max.level = 1)
#> List of 5
#>  $ mean    : num 0.302
#>  $ se      : num 0.17
#>  $ ci_lower: num -0.0322
#>  $ ci_upper: num 0.636
#>  $ n_domain: num 20